diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-08-08 19:01:20 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-08-13 15:29:14 +0000 |
| commit | 6747bf7e223e5400af1c434618b14debd8dca0cf (patch) | |
| tree | c8479c4207366eabf05209e70b236bb9d4e82ab4 | |
| parent | e2cfbd498af88a211b0b347861cfd989e57cd1fb (diff) | |
linuxkpi: stop inlining accesses to curthread->td_lkpi_task
This should provide much higher resistence against struct thread layout
changes for out-of-tree modules depending on linuxkpi.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58733
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/sched.h | 7 | ||||
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_compat.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index 3ad2f8e4ce8b..4e2a0f3676a9 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -92,11 +92,8 @@ struct task_struct { unsigned int fpu_ctx_level; }; -#define current ({ \ - struct thread *__td = curthread; \ - linux_set_current(__td); \ - ((struct task_struct *)__td->td_lkpi_task); \ -}) +struct task_struct *__lkpi_current(void); +#define current (__lkpi_current()) #define task_pid_group_leader(task) (task)->task_thread->td_proc->p_pid #define task_pid(task) ((task)->pid) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 78abbf1716e4..4ac59bcfbb79 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -170,6 +170,16 @@ const guid_t guid_null; enum system_states system_state = SYSTEM_RUNNING; +struct task_struct * +__lkpi_current(void) +{ + struct thread *td; + + td = curthread; + linux_set_current(td); + return ((struct task_struct *)td->td_lkpi_task); +} + int panic_cmp(struct rb_node *one, struct rb_node *two) { |
