lkml.org 
[lkml]   [2012]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v11 05/12] arch/x86: add syscall_get_arch to syscall.h
    Date
    Add syscall_get_arch() to export the current AUDIT_ARCH_* based on system call
    entry path.

    Signed-off-by: Will Drewry <wad@chromium.org>
    ---
    arch/x86/include/asm/syscall.h | 23 +++++++++++++++++++++++
    1 files changed, 23 insertions(+), 0 deletions(-)

    diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
    index d962e56..1d713e4 100644
    --- a/arch/x86/include/asm/syscall.h
    +++ b/arch/x86/include/asm/syscall.h
    @@ -13,6 +13,7 @@
    #ifndef _ASM_X86_SYSCALL_H
    #define _ASM_X86_SYSCALL_H

    +#include <linux/audit.h>
    #include <linux/sched.h>
    #include <linux/err.h>
    #include <asm/asm-offsets.h> /* For NR_syscalls */
    @@ -87,6 +88,12 @@ static inline void syscall_set_arguments(struct task_struct *task,
    memcpy(&regs->bx + i, args, n * sizeof(args[0]));
    }

    +static inline int syscall_get_arch(struct task_struct *task,
    + struct pt_regs *regs)
    +{
    + return AUDIT_ARCH_I386;
    +}
    +
    #else /* CONFIG_X86_64 */

    static inline void syscall_get_arguments(struct task_struct *task,
    @@ -211,6 +218,22 @@ static inline void syscall_set_arguments(struct task_struct *task,
    }
    }

    +static inline int syscall_get_arch(struct task_struct *task,
    + struct pt_regs *regs)
    +{
    +#ifdef CONFIG_IA32_EMULATION
    + /*
    + * TS_COMPAT is set for 32-bit syscall entries and then
    + * remains set until we return to user mode.
    + *
    + * TIF_IA32 tasks should always have TS_COMPAT set at
    + * system call time.
    + */
    + if (task_thread_info(task)->status & TS_COMPAT)
    + return AUDIT_ARCH_I386;
    +#endif
    + return AUDIT_ARCH_X86_64;
    +}
    #endif /* CONFIG_X86_32 */

    #endif /* _ASM_X86_SYSCALL_H */
    --
    1.7.5.4


    \
     
     \ /
      Last update: 2012-02-25 04:27    [W:0.023 / U:59.380 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site