MIPS: Add new AUDIT_ARCH token for the N32 ABI on MIPS64
A MIPS64 kernel may support ELF files for all 3 MIPS ABIs (O32, N32, N64). Furthermore, the AUDIT_ARCH_MIPS{,EL}64 token does not provide enough information about the ABI for the 64-bit process. As a result of which, userland needs to use complex seccomp filters to decide whether a syscall belongs to the o32 or n32 or n64 ABI. Therefore, a new arch token for MIPS64/n32 is added so it can be used by seccomp to explicitely set syscall filters for this ABI. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Acked-by: Eric Paris <eparis@redhat.com> Acked-by: Paul Moore <pmoore@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: linux-mips@linux-mips.org Link: http://sourceforge.net/p/libseccomp/mailman/message/32239040/ Patchwork: https://patchwork.linux-mips.org/patch/6818/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Родитель
367f0b50e5
Коммит
f2d0801f00
|
@ -133,6 +133,8 @@ static inline int syscall_get_arch(void)
|
||||||
#ifdef CONFIG_64BIT
|
#ifdef CONFIG_64BIT
|
||||||
if (!test_thread_flag(TIF_32BIT_REGS))
|
if (!test_thread_flag(TIF_32BIT_REGS))
|
||||||
arch |= __AUDIT_ARCH_64BIT;
|
arch |= __AUDIT_ARCH_64BIT;
|
||||||
|
if (test_thread_flag(TIF_32BIT_ADDR))
|
||||||
|
arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__LITTLE_ENDIAN)
|
#if defined(__LITTLE_ENDIAN)
|
||||||
arch |= __AUDIT_ARCH_LE;
|
arch |= __AUDIT_ARCH_LE;
|
||||||
|
|
|
@ -331,9 +331,17 @@ enum {
|
||||||
#define AUDIT_FAIL_PRINTK 1
|
#define AUDIT_FAIL_PRINTK 1
|
||||||
#define AUDIT_FAIL_PANIC 2
|
#define AUDIT_FAIL_PANIC 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These bits disambiguate different calling conventions that share an
|
||||||
|
* ELF machine type, bitness, and endianness
|
||||||
|
*/
|
||||||
|
#define __AUDIT_ARCH_CONVENTION_MASK 0x30000000
|
||||||
|
#define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000
|
||||||
|
|
||||||
/* distinguish syscall tables */
|
/* distinguish syscall tables */
|
||||||
#define __AUDIT_ARCH_64BIT 0x80000000
|
#define __AUDIT_ARCH_64BIT 0x80000000
|
||||||
#define __AUDIT_ARCH_LE 0x40000000
|
#define __AUDIT_ARCH_LE 0x40000000
|
||||||
|
|
||||||
#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||||
#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
|
#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
|
||||||
#define AUDIT_ARCH_ARMEB (EM_ARM)
|
#define AUDIT_ARCH_ARMEB (EM_ARM)
|
||||||
|
@ -346,7 +354,11 @@ enum {
|
||||||
#define AUDIT_ARCH_MIPS (EM_MIPS)
|
#define AUDIT_ARCH_MIPS (EM_MIPS)
|
||||||
#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
|
#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
|
||||||
#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
|
#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
|
||||||
|
#define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\
|
||||||
|
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
|
||||||
#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||||
|
#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE\
|
||||||
|
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
|
||||||
#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
|
#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
|
||||||
#define AUDIT_ARCH_PARISC (EM_PARISC)
|
#define AUDIT_ARCH_PARISC (EM_PARISC)
|
||||||
#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
|
#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче