git: 6747bf7e223e - main - linuxkpi: stop inlining accesses to curthread->td_lkpi_task
Konstantin Belousov <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6747bf7e223e5400af1c434618b14debd8dca0cf commit 6747bf7e223e5400af1c434618b14debd8dca0cf Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-08-08 19:01:20 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-08-13 15:29:14 +0000 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 --- sys/compat/linuxkpi/common/include/linux/sched.h | 7 ++----- 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) {