]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Merge tag 'audit-pr-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoor...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 May 2019 02:06:04 +0000 (19:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 May 2019 02:06:04 +0000 (19:06 -0700)
Pull audit updates from Paul Moore:
 "We've got a reasonably broad set of audit patches for the v5.2 merge
  window, the highlights are below:

   - The biggest change, and the source of all the arch/* changes, is
     the patchset from Dmitry to help enable some of the work he is
     doing around PTRACE_GET_SYSCALL_INFO.

     To be honest, including this in the audit tree is a bit of a
     stretch, but it does help move audit a little further along towards
     proper syscall auditing for all arches, and everyone else seemed to
     agree that audit was a "good" spot for this to land (or maybe they
     just didn't want to merge it? dunno.).

   - We can now audit time/NTP adjustments.

   - We continue the work to connect associated audit records into a
     single event"

* tag 'audit-pr-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: (21 commits)
  audit: fix a memory leak bug
  ntp: Audit NTP parameters adjustment
  timekeeping: Audit clock adjustments
  audit: purge unnecessary list_empty calls
  audit: link integrity evm_write_xattrs record to syscall event
  syscall_get_arch: add "struct task_struct *" argument
  unicore32: define syscall_get_arch()
  Move EM_UNICORE to uapi/linux/elf-em.h
  nios2: define syscall_get_arch()
  nds32: define syscall_get_arch()
  Move EM_NDS32 to uapi/linux/elf-em.h
  m68k: define syscall_get_arch()
  hexagon: define syscall_get_arch()
  Move EM_HEXAGON to uapi/linux/elf-em.h
  h8300: define syscall_get_arch()
  c6x: define syscall_get_arch()
  arc: define syscall_get_arch()
  Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
  audit: Make audit_log_cap and audit_copy_inode static
  audit: connect LOGIN record to its syscall record
  ...

26 files changed:
1  2 
arch/arc/include/asm/syscall.h
arch/arm/include/asm/syscall.h
arch/arm64/include/asm/syscall.h
arch/c6x/include/asm/syscall.h
arch/csky/include/asm/syscall.h
arch/h8300/include/asm/syscall.h
arch/hexagon/include/asm/syscall.h
arch/ia64/include/asm/syscall.h
arch/microblaze/include/asm/syscall.h
arch/mips/include/asm/syscall.h
arch/mips/kernel/ptrace.c
arch/nds32/include/asm/syscall.h
arch/nios2/include/asm/syscall.h
arch/openrisc/include/asm/syscall.h
arch/parisc/include/asm/syscall.h
arch/powerpc/include/asm/syscall.h
arch/riscv/include/asm/syscall.h
arch/s390/include/asm/syscall.h
arch/sh/include/asm/syscall_32.h
arch/sh/include/asm/syscall_64.h
arch/sparc/include/asm/syscall.h
arch/x86/include/asm/syscall.h
arch/xtensa/include/asm/syscall.h
include/asm-generic/syscall.h
kernel/seccomp.c
kernel/time/timekeeping.c

Simple merge
index 080ce70cab12a6944af4120ed5a3b9ca9889411d,3940ceac0bdcbe1c7eb4431688779c587d3d9ed5..fd02761ba06cf5f1a2e780ee4ece115f7861c262
@@@ -65,15 -82,29 +65,15 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      if (n == 0)
 -              return;
 -
 -      if (i + n > SYSCALL_MAX_ARGS) {
 -              pr_warn("%s called with max args %d, handling only %d\n",
 -                      __func__, i + n, SYSCALL_MAX_ARGS);
 -              n = SYSCALL_MAX_ARGS - i;
 -      }
 -
 -      if (i == 0) {
 -              regs->ARM_ORIG_r0 = args[0];
 -              args++;
 -              i++;
 -              n--;
 -      }
 -
 -      memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
 +      regs->ARM_ORIG_r0 = args[0];
 +      args++;
 +
 +      memcpy(&regs->ARM_r0 + 1, args, 5 * sizeof(args[0]));
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        /* ARM tasks don't change audit architectures on the fly. */
        return AUDIT_ARCH_ARM;
Simple merge
index 15ba8599858e6be5a860e23f338c8bd292da7207,595057191c9cc9245e2287ee7aa03e3e84c8552f..5bcdcb651b193ee1c7ea2ca5de4a21085e76d681
@@@ -59,14 -85,46 +60,20 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      switch (i) {
 -      case 0:
 -              if (!n--)
 -                      break;
 -              regs->a4 = *args++;
 -      case 1:
 -              if (!n--)
 -                      break;
 -              regs->b4 = *args++;
 -      case 2:
 -              if (!n--)
 -                      break;
 -              regs->a6 = *args++;
 -      case 3:
 -              if (!n--)
 -                      break;
 -              regs->b6 = *args++;
 -      case 4:
 -              if (!n--)
 -                      break;
 -              regs->a8 = *args++;
 -      case 5:
 -              if (!n--)
 -                      break;
 -              regs->a9 = *args++;
 -      case 6:
 -              if (!n)
 -                      break;
 -      default:
 -              BUG();
 -      }
 +      regs->a4 = *args++;
 +      regs->b4 = *args++;
 +      regs->a6 = *args++;
 +      regs->b6 = *args++;
 +      regs->a8 = *args++;
 +      regs->a9 = *args;
  }
  
+ static inline int syscall_get_arch(struct task_struct *task)
+ {
+       return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+               ? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;
+ }
  #endif /* __ASM_C6X_SYSCALLS_H */
Simple merge
index ddd483c6ca95c9df50e9ed7b8c820c9884afcbeb,d316c3d40d4e3fce2830df039876d96b81594145..01666b8bb2631a1d3374b854a2589b24a4a31be1
@@@ -17,16 -18,41 +18,21 @@@ syscall_get_nr(struct task_struct *task
  
  static inline void
  syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 -                    unsigned int i, unsigned int n, unsigned long *args)
 +                    unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -
 -      while (n > 0) {
 -              switch (i) {
 -              case 0:
 -                      *args++ = regs->er1;
 -                      break;
 -              case 1:
 -                      *args++ = regs->er2;
 -                      break;
 -              case 2:
 -                      *args++ = regs->er3;
 -                      break;
 -              case 3:
 -                      *args++ = regs->er4;
 -                      break;
 -              case 4:
 -                      *args++ = regs->er5;
 -                      break;
 -              case 5:
 -                      *args++ = regs->er6;
 -                      break;
 -              }
 -              i++;
 -              n--;
 -      }
 +      *args++ = regs->er1;
 +      *args++ = regs->er2;
 +      *args++ = regs->er3;
 +      *args++ = regs->er4;
 +      *args++ = regs->er5;
 +      *args   = regs->er6;
  }
  
+ static inline int
+ syscall_get_arch(struct task_struct *task)
+ {
+       return AUDIT_ARCH_H8300;
+ }
  
  
  /* Misc syscall related bits */
index ae3a1e24fabd7193ff7d3dc142c4ca7d123f56e6,47b0bc3f16be5a1ad7d8f598277e2a8782092ad5..dab26a71f577ba2054ca53abbc7874c583c51fa4
@@@ -37,8 -39,16 +39,14 @@@ static inline long syscall_get_nr(struc
  
  static inline void syscall_get_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -      memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
 +      memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
  }
+ static inline int syscall_get_arch(struct task_struct *task)
+ {
+       return AUDIT_ARCH_HEXAGON;
+ }
  #endif
index 0d9e7fab4a79fddcc63d24c30f002e73d2b91db0,47ab33f5448aa623b9946c80215f091d5cc6d2f5..da108cd451745d1a096640628b19bf9633bc84bc
@@@ -69,12 -73,15 +69,12 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -
 -      ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
 +      ia64_syscall_get_set_arguments(task, regs, args, 1);
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        return AUDIT_ARCH_IA64;
  }
Simple merge
Simple merge
index 3a62f80958e170527a93f4058d60f5372d5773ee,2ead6ff919b768e8c75aa47aa811b8dc474de4b1..414b6e9c900b2c9e455389b9f557d69c16e9c4b2
@@@ -1418,8 -1418,8 +1418,8 @@@ asmlinkage long syscall_trace_enter(str
                unsigned long args[6];
  
                sd.nr = syscall;
-               sd.arch = syscall_get_arch();
+               sd.arch = syscall_get_arch(current);
 -              syscall_get_arguments(current, regs, 0, 6, args);
 +              syscall_get_arguments(current, regs, args);
                for (i = 0; i < 6; i++)
                        sd.args[i] = args[i];
                sd.instruction_pointer = KSTK_EIP(current);
index 671ebd357496c4e1608b240d2ba23c4d3d9efa42,7501e376a6b137c95480c79e87e82f19ee8674c3..174b8571d362e5600acd5f173e947829111a90b5
@@@ -136,13 -161,37 +137,21 @@@ void syscall_get_arguments(struct task_
   *
   * It's only valid to call this when @task is stopped for tracing on
   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
 - * It's invalid to call this with @i + @n > 6; we only support system calls
 - * taking up to 6 arguments.
   */
  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 -                         unsigned int i, unsigned int n,
                           const unsigned long *args)
  {
 -      if (n == 0)
 -              return;
 -
 -      if (i + n > SYSCALL_MAX_ARGS) {
 -              pr_warn("%s called with max args %d, handling only %d\n",
 -                      __func__, i + n, SYSCALL_MAX_ARGS);
 -              n = SYSCALL_MAX_ARGS - i;
 -      }
 -
 -      if (i == 0) {
 -              regs->orig_r0 = args[0];
 -              args++;
 -              i++;
 -              n--;
 -      }
 +      regs->orig_r0 = args[0];
 +      args++;
  
 -      memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
 +      memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
  }
+ static inline int
+ syscall_get_arch(struct task_struct *task)
+ {
+       return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+               ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
+ }
  #endif /* _ASM_NDS32_SYSCALL_H */
index d7624ed06efb6c9ea2e616c23cd20b030a53b1c8,f0f6ae208e78980b72e469018ddf30ea50a282ed..c4f3f8b86f284cbe1eb56f892b523fefc4dc7744
@@@ -69,14 -98,47 +70,19 @@@ static inline void syscall_get_argument
  }
  
  static inline void syscall_set_arguments(struct task_struct *task,
 -      struct pt_regs *regs, unsigned int i, unsigned int n,
 -      const unsigned long *args)
 +      struct pt_regs *regs, const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -
 -      switch (i) {
 -      case 0:
 -              if (!n--)
 -                      break;
 -              regs->r4 = *args++;
 -      case 1:
 -              if (!n--)
 -                      break;
 -              regs->r5 = *args++;
 -      case 2:
 -              if (!n--)
 -                      break;
 -              regs->r6 = *args++;
 -      case 3:
 -              if (!n--)
 -                      break;
 -              regs->r7 = *args++;
 -      case 4:
 -              if (!n--)
 -                      break;
 -              regs->r8 = *args++;
 -      case 5:
 -              if (!n--)
 -                      break;
 -              regs->r9 = *args++;
 -      case 6:
 -              if (!n)
 -                      break;
 -      default:
 -              BUG();
 -      }
 +      regs->r4 = *args++;
 +      regs->r5 = *args++;
 +      regs->r6 = *args++;
 +      regs->r7 = *args++;
 +      regs->r8 = *args++;
 +      regs->r9 = *args;
  }
  
+ static inline int syscall_get_arch(struct task_struct *task)
+ {
+       return AUDIT_ARCH_NIOS2;
+ }
  #endif
index b4ff07c1baed5d13c9abb0d025a1ece11ee78ad0,46b10c674bd203e85a09632a0235ff5f6988325d..61de227f53a1d8c5fddde42bb7ebb56247eea30a
@@@ -63,12 -65,14 +63,12 @@@ syscall_get_arguments(struct task_struc
  
  static inline void
  syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 -                    unsigned int i, unsigned int n, const unsigned long *args)
 +                    const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -
 -      memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
 +      memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        return AUDIT_ARCH_OPENRISC;
  }
Simple merge
index 1243045bad2d633d4bd2df3d3e086bd2988987d0,efb50429c9f4ba2aa65c599b780f78db14fae33a..a048fed0722fa95f0384f23847e1e4a0d15bb279
@@@ -86,17 -88,26 +86,23 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -      memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
 +      memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
  
        /* Also copy the first argument into orig_gpr3 */
 -      if (i == 0 && n > 0)
 -              regs->orig_gpr3 = args[0];
 +      regs->orig_gpr3 = args[0];
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
-       int arch = is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64;
+       int arch;
+       if (IS_ENABLED(CONFIG_PPC64) && !test_tsk_thread_flag(task, TIF_32BIT))
+               arch = AUDIT_ARCH_PPC64;
+       else
+               arch = AUDIT_ARCH_PPC;
  #ifdef __LITTLE_ENDIAN__
        arch |= __AUDIT_ARCH_LE;
  #endif
index a3d5273ded7c6d0782356f01abf7d5cdca753bc5,ca120a36a037a2b99fa200dd23ad9e58699bb1e5..0f2fe1794c8fe3b7e6bc08e27d2d57bc3a1d50cd
@@@ -81,14 -87,20 +81,14 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -        if (i == 0) {
 -                regs->orig_a0 = args[0];
 -                args++;
 -                i++;
 -                n--;
 -        }
 -      memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
 +      regs->orig_a0 = args[0];
 +      args++;
 +      memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
  #ifdef CONFIG_64BIT
        return AUDIT_ARCH_RISCV64;
index ab3407aa4fd8232ec32b3ff5e898f75f092b7170,5a40ea8b90ea88e2639179a2d264810554f44b0e..f073292e9fdb133462c40eb3dbaa4877cb5c98b7
@@@ -69,20 -81,21 +69,20 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 +      unsigned int n = 6;
 +
        while (n-- > 0)
 -              if (i + n > 0)
 -                      regs->gprs[2 + i + n] = args[n];
 -      if (i == 0)
 -              regs->orig_gpr2 = args[0];
 +              if (n > 0)
 +                      regs->gprs[2 + n] = args[n];
 +      regs->orig_gpr2 = args[0];
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
  #ifdef CONFIG_COMPAT
-       if (test_tsk_thread_flag(current, TIF_31BIT))
+       if (test_tsk_thread_flag(task, TIF_31BIT))
                return AUDIT_ARCH_S390;
  #endif
        return AUDIT_ARCH_S390X;
index 8c9d7e5e5dcc02375eeafab25e47878b76239aaa,08de429eccd4228e3c12ee810b68e19a94dee742..0b5b8e75edacc5a128b386de2523b067383abf61
@@@ -62,17 -76,26 +62,17 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      /* Same note as above applies */
 -      BUG_ON(i);
 -
 -      switch (n) {
 -      case 6: regs->regs[1] = args[5];
 -      case 5: regs->regs[0] = args[4];
 -      case 4: regs->regs[7] = args[3];
 -      case 3: regs->regs[6] = args[2];
 -      case 2: regs->regs[5] = args[1];
 -      case 1: regs->regs[4] = args[0];
 -              break;
 -      default:
 -              BUG();
 -      }
 +      regs->regs[1] = args[5];
 +      regs->regs[0] = args[4];
 +      regs->regs[7] = args[3];
 +      regs->regs[6] = args[2];
 +      regs->regs[5] = args[1];
 +      regs->regs[4] = args[0];
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        int arch = AUDIT_ARCH_SH;
  
index 22fad97da06619a137f6f4cd3e3ca4f6a9bddfcc,9b62a2404531a3cfa51c53f76d4b7191512b16e7..72efcbc76f916bc3543f9b7fa8c4d44b0e69bbb8
@@@ -54,12 -56,14 +54,12 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      BUG_ON(i + n > 6);
 -      memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
 +      memcpy(&regs->regs[2], args, 6 * sizeof(args[0]));
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        int arch = AUDIT_ARCH_SH;
  
index 4d075434e8164c18e140249d65cbffdb28290dc6,9ffb367c17fd8c3da629839aaa5fd34b966b7721..62a5a78804c46d76f5155d337117f8c7fee0baf1
@@@ -119,18 -119,20 +119,19 @@@ static inline void syscall_get_argument
  
  static inline void syscall_set_arguments(struct task_struct *task,
                                         struct pt_regs *regs,
 -                                       unsigned int i, unsigned int n,
                                         const unsigned long *args)
  {
 -      unsigned int j;
 +      unsigned int i;
  
 -      for (j = 0; j < n; j++)
 -              regs->u_regs[UREG_I0 + i + j] = args[j];
 +      for (i = 0; i < 6; i++)
 +              regs->u_regs[UREG_I0 + i] = args[i];
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
  #if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT)
-       return in_compat_syscall() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
+       return test_tsk_thread_flag(task, TIF_32BIT)
+               ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
  #elif defined(CONFIG_SPARC64)
        return AUDIT_ARCH_SPARC64;
  #else
index 4c305471ec3312e3b0adc7063c30e9d3edf2de7f,435f3f09279c3825a7e718c58c9ba93e2f7e8726..b05ad16174e5c7736565e6cab7f8046a308bec82
@@@ -141,29 -180,68 +141,31 @@@ static inline void syscall_set_argument
                                         const unsigned long *args)
  {
  # ifdef CONFIG_IA32_EMULATION
 -      if (task->thread_info.status & TS_COMPAT)
 -              switch (i) {
 -              case 0:
 -                      if (!n--) break;
 -                      regs->bx = *args++;
 -              case 1:
 -                      if (!n--) break;
 -                      regs->cx = *args++;
 -              case 2:
 -                      if (!n--) break;
 -                      regs->dx = *args++;
 -              case 3:
 -                      if (!n--) break;
 -                      regs->si = *args++;
 -              case 4:
 -                      if (!n--) break;
 -                      regs->di = *args++;
 -              case 5:
 -                      if (!n--) break;
 -                      regs->bp = *args++;
 -              case 6:
 -                      if (!n--) break;
 -              default:
 -                      BUG();
 -                      break;
 -              }
 -      else
 +      if (task->thread_info.status & TS_COMPAT) {
 +              regs->bx = *args++;
 +              regs->cx = *args++;
 +              regs->dx = *args++;
 +              regs->si = *args++;
 +              regs->di = *args++;
 +              regs->bp = *args;
 +      } else
  # endif
 -              switch (i) {
 -              case 0:
 -                      if (!n--) break;
 -                      regs->di = *args++;
 -              case 1:
 -                      if (!n--) break;
 -                      regs->si = *args++;
 -              case 2:
 -                      if (!n--) break;
 -                      regs->dx = *args++;
 -              case 3:
 -                      if (!n--) break;
 -                      regs->r10 = *args++;
 -              case 4:
 -                      if (!n--) break;
 -                      regs->r8 = *args++;
 -              case 5:
 -                      if (!n--) break;
 -                      regs->r9 = *args++;
 -              case 6:
 -                      if (!n--) break;
 -              default:
 -                      BUG();
 -                      break;
 -              }
 +      {
 +              regs->di = *args++;
 +              regs->si = *args++;
 +              regs->dx = *args++;
 +              regs->r10 = *args++;
 +              regs->r8 = *args++;
 +              regs->r9 = *args;
 +      }
  }
  
- static inline int syscall_get_arch(void)
+ static inline int syscall_get_arch(struct task_struct *task)
  {
        /* x32 tasks should be considered AUDIT_ARCH_X86_64. */
-       return in_ia32_syscall() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
+       return (IS_ENABLED(CONFIG_IA32_EMULATION) &&
+               task->thread_info.status & TS_COMPAT)
+               ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
  }
  #endif        /* CONFIG_X86_32 */
  
Simple merge
Simple merge
index a635ecba6fe25a9c5abed70e7d42990b502774cc,36f36ab00f488754bbb2ecac1b236c7589ebfc8a..811b4a86cdf6b5de2ed39c02d0efa71fd7409d7d
@@@ -148,8 -148,8 +148,8 @@@ static void populate_seccomp_data(struc
        unsigned long args[6];
  
        sd->nr = syscall_get_nr(task, regs);
-       sd->arch = syscall_get_arch();
+       sd->arch = syscall_get_arch(task);
 -      syscall_get_arguments(task, regs, 0, 6, args);
 +      syscall_get_arguments(task, regs, args);
        sd->args[0] = args[0];
        sd->args[1] = args[1];
        sd->args[2] = args[2];
Simple merge