All of lore.kernel.org
 help / color / mirror / Atom feed
  • * [PATCH 3.15] MIPS: Add new AUDIT_ARCH token for the N32 ABI on MIPS64
    @ 2014-04-22 14:40   ` Markos Chandras
      0 siblings, 0 replies; 20+ messages in thread
    From: Markos Chandras @ 2014-04-22 14:40 UTC (permalink / raw)
      To: linux-mips
      Cc: Markos Chandras, Andy Lutomirski, Eric Paris, Paul Moore,
    	Ralf Baechle
    
    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.
    
    Link: http://sourceforge.net/p/libseccomp/mailman/message/32239040/
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Eric Paris <eparis@redhat.com>
    Cc: Paul Moore <pmoore@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
    ---
    Ralf, can we please have this in 3.15 (Assuming it's ACK'd)?
    
    Thanks a lot!
    ---
     arch/mips/include/asm/syscall.h |  2 ++
     include/uapi/linux/audit.h      | 12 ++++++++++++
     2 files changed, 14 insertions(+)
    
    diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
    index c6e9cd2..17960fe 100644
    --- a/arch/mips/include/asm/syscall.h
    +++ b/arch/mips/include/asm/syscall.h
    @@ -133,6 +133,8 @@ static inline int syscall_get_arch(void)
     #ifdef CONFIG_64BIT
     	if (!test_thread_flag(TIF_32BIT_REGS))
     		arch |= __AUDIT_ARCH_64BIT;
    +	if (test_thread_flag(TIF_32BIT_ADDR))
    +		arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
     #endif
     #if defined(__LITTLE_ENDIAN)
     	arch |=  __AUDIT_ARCH_LE;
    diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
    index 11917f7..1b1efdd 100644
    --- a/include/uapi/linux/audit.h
    +++ b/include/uapi/linux/audit.h
    @@ -331,9 +331,17 @@ enum {
     #define AUDIT_FAIL_PRINTK	1
     #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 */
     #define __AUDIT_ARCH_64BIT 0x80000000
     #define __AUDIT_ARCH_LE	   0x40000000
    +
     #define AUDIT_ARCH_ALPHA	(EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
     #define AUDIT_ARCH_ARM		(EM_ARM|__AUDIT_ARCH_LE)
     #define AUDIT_ARCH_ARMEB	(EM_ARM)
    @@ -346,7 +354,11 @@ enum {
     #define AUDIT_ARCH_MIPS		(EM_MIPS)
     #define AUDIT_ARCH_MIPSEL	(EM_MIPS|__AUDIT_ARCH_LE)
     #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_MIPSEL64N32	(EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE\
    +				 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
     #define AUDIT_ARCH_OPENRISC	(EM_OPENRISC)
     #define AUDIT_ARCH_PARISC	(EM_PARISC)
     #define AUDIT_ARCH_PARISC64	(EM_PARISC|__AUDIT_ARCH_64BIT)
    -- 
    1.9.2
    
    ^ permalink raw reply related	[flat|nested] 20+ messages in thread

  • end of thread, other threads:[~2014-05-21 22:10 UTC | newest]
    
    Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <1397550996-14805-1-git-send-email-markos.chandras@imgtec.com>
         [not found] ` <1397738551.2725.18.camel@localhost>
         [not found]   ` <534FCF75.7060708@imgtec.com>
         [not found]     ` <4648181.no7KCQCtEi@sifl>
         [not found]       ` <534FFBCF.5010800@imgtec.com>
         [not found]         ` <1397750939.750.1.camel@localhost>
    2014-04-17 16:20           ` [libseccomp-discuss] [PATCH v3 0/2] Add support for MIPS BE/LE and O32 ABI Andy Lutomirski
    2014-04-17 16:24             ` Markos Chandras
    2014-04-17 16:24               ` Markos Chandras
    2014-04-17 19:13               ` Ralf Baechle
    2014-04-17 19:38                 ` Andy Lutomirski
    2014-04-17 20:07                   ` Ralf Baechle
    2014-04-17 20:30                     ` Paul Moore
    2014-04-22 14:40 ` [PATCH 3.15] MIPS: Add new AUDIT_ARCH token for the N32 ABI on MIPS64 Markos Chandras
    2014-04-22 14:40   ` Markos Chandras
    2014-04-24 19:19   ` Paul Moore
    2014-04-30  9:24     ` Markos Chandras
    2014-04-30  9:24       ` Markos Chandras
    2014-05-06  7:47       ` Markos Chandras
    2014-05-06  7:47         ` Markos Chandras
    2014-05-08 14:10       ` Paul Moore
    2014-05-12 18:53   ` Paul Moore
    2014-05-12 19:09     ` Eric Paris
    2014-05-21 20:59     ` Paul Moore
    2014-05-21 21:07       ` Andy Lutomirski
    2014-05-21 22:10       ` James Hogan
    

    This is an external index of several public inboxes,
    see mirroring instructions on how to clone and mirror
    all data and code used by this external index.