Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace

elf_read_implies_exec() is a kernel-only feature as the second parameter is a
constant that isn't exported to userspace. Not only that, but the
arch-specific overrides are not exported either.

So hide the macro from userspace.

Similarly, struct file should not be predeclared in userspace.

Signed-off-by: David Howells <dhowells@redhat.com>

+9 -9
+9 -9
include/linux/elf.h
··· 7 7 #include <asm/elf.h> 8 8 #endif 9 9 10 - struct file; 11 - 12 - #ifndef elf_read_implies_exec 13 - /* Executables for which elf_read_implies_exec() returns TRUE will 14 - have the READ_IMPLIES_EXEC personality flag set automatically. 15 - Override in asm/elf.h as needed. */ 16 - # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 17 - #endif 18 - 19 10 /* 32-bit ELF base types. */ 20 11 typedef __u32 Elf32_Addr; 21 12 typedef __u16 Elf32_Half; ··· 405 414 } Elf64_Nhdr; 406 415 407 416 #ifdef __KERNEL__ 417 + #ifndef elf_read_implies_exec 418 + /* Executables for which elf_read_implies_exec() returns TRUE will 419 + have the READ_IMPLIES_EXEC personality flag set automatically. 420 + Override in asm/elf.h as needed. */ 421 + # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 422 + #endif 423 + 408 424 #if ELF_CLASS == ELFCLASS32 409 425 410 426 extern Elf32_Dyn _DYNAMIC []; ··· 435 437 #endif 436 438 437 439 /* Optional callbacks to write extra ELF notes. */ 440 + struct file; 441 + 438 442 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES 439 443 static inline int elf_coredump_extra_notes_size(void) { return 0; } 440 444 static inline int elf_coredump_extra_notes_write(struct file *file,