Skip to content

Commit 0badc51

Browse files
ekoopspoiana
authored andcommitted
fix(driver): compile support for s390 compat support conditionally
Commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e0b986c59c67e08ada646249f834655a9e6da16 removed 31-bit code support for s390 and any related macro, so compile out from kmod the check involving the usage of the dropped `_TIF_31BIT` macro if this is not available on the kernel against which we compile. Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
1 parent 957e96b commit 0badc51

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
3+
Copyright (C) 2026 The Falco Authors.
4+
5+
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
6+
or GPL2.txt for full copies of the license.
7+
8+
*/
9+
10+
#include <linux/module.h>
11+
#include <linux/sched.h>
12+
#include <linux/thread_info.h>
13+
14+
MODULE_LICENSE("GPL");
15+
MODULE_AUTHOR("the Falco authors");
16+
17+
static int compat_s390_init(void) {
18+
#ifdef CONFIG_S390
19+
unsigned long flags = task_thread_info(current)->flags & _TIF_31BIT;
20+
(void)flags;
21+
#endif /* CONFIG_S390 */
22+
return 0;
23+
}
24+
25+
static void compat_s390_exit(void) {}
26+
27+
module_init(compat_s390_init);
28+
module_exit(compat_s390_exit);

driver/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ static inline bool kmod_in_ia32_syscall(void) {
19761976
#elif defined(CONFIG_ARM64)
19771977
if(unlikely(task_thread_info(current)->flags & _TIF_32BIT))
19781978
return true;
1979-
#elif defined(CONFIG_S390)
1979+
#elif defined(CONFIG_S390) && HAS_COMPAT_S390
19801980
if(unlikely(task_thread_info(current)->flags & _TIF_31BIT))
19811981
return true;
19821982
#elif defined(CONFIG_PPC64)

0 commit comments

Comments
 (0)