diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-04-14 15:46:39 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2023-04-20 23:08:43 +0200 |
commit | 6032aca0deb9c138df122192f8ef02de1fdccf25 (patch) | |
tree | f9acfe2a2c09cfa1b3a86351b8bdf2ccd8fa48ef /arch/x86/um/shared/sysdep/stub_32.h | |
parent | um: prevent user code in modules (diff) | |
download | linux-6032aca0deb9c138df122192f8ef02de1fdccf25.tar.gz linux-6032aca0deb9c138df122192f8ef02de1fdccf25.tar.bz2 linux-6032aca0deb9c138df122192f8ef02de1fdccf25.zip |
um: make stub data pages size tweakable
There's a lot of code here that hard-codes that the
data is a single page, and right now that seems to
be sufficient, but to make it easier to change this
in the future, add a new STUB_DATA_PAGES constant
and use it throughout the code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/x86/um/shared/sysdep/stub_32.h')
-rw-r--r-- | arch/x86/um/shared/sysdep/stub_32.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/um/shared/sysdep/stub_32.h b/arch/x86/um/shared/sysdep/stub_32.h index 4c6c2be0c899..38fa894b65d0 100644 --- a/arch/x86/um/shared/sysdep/stub_32.h +++ b/arch/x86/um/shared/sysdep/stub_32.h @@ -89,19 +89,19 @@ static inline void remap_stack_and_trap(void) "addl %4,%%ebx ; movl %%eax, (%%ebx) ;" "int $3" : : - "g" (~(UM_KERN_PAGE_SIZE - 1)), + "g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)), "g" (STUB_MMAP_NR), "g" (UML_STUB_FIELD_FD), "g" (UML_STUB_FIELD_OFFSET), "g" (UML_STUB_FIELD_CHILD_ERR), - "c" (UM_KERN_PAGE_SIZE), + "c" (STUB_DATA_PAGES * UM_KERN_PAGE_SIZE), "d" (PROT_READ | PROT_WRITE), "S" (MAP_FIXED | MAP_SHARED) : "memory"); } -static __always_inline void *get_stub_page(void) +static __always_inline void *get_stub_data(void) { unsigned long ret; @@ -109,7 +109,7 @@ static __always_inline void *get_stub_page(void) "movl %%esp,%0 ;" "andl %1,%0" : "=a" (ret) - : "g" (~(UM_KERN_PAGE_SIZE - 1))); + : "g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1))); return (void *)ret; } |