audit: add missing syscalls to PERM class tables
Subsystems (2)
PATCH 1/1 audit: add missing syscalls to PERM class tables
Add missing file timestamp and attribute syscalls to the audit PERM class tables. The most critical gap was the complete absence of timestamp syscalls from audit_change_attr.h, which meant timestamp syscalls failed the kernel-side AUDIT_PERM_ATTR class check, so rules using perm=a did not match those operations.
Changes:
- audit_change_attr.h: Add utime, utimes, futimesat, utimensat, utimensat_time64, and file_setattr
- audit_read.h: Add quotactl_fd, file_getattr, stat, lstat, fstat, newfstatat, and statx
- audit_write.h: Add quotactl_fd
Architecture-specific and conditionally-compiled syscalls are guarded with #ifdef.
--- include/asm-generic/audit_change_attr.h | 16 ++++++++++++++++ include/asm-generic/audit_read.h | 19 +++++++++++++++++++ include/asm-generic/audit_write.h | 3 +++ 3 files changed, 38 insertions(+)
include/asm-generic/audit_change_attr.h +16 -0
@@ -40,3 +40,19 @@ __NR_link,#ifdef __NR_linkat __NR_linkat,#endif +#ifdef __NR_utime +__NR_utime, +#endif +#ifdef __NR_utimes +__NR_utimes, +#endif +#ifdef __NR_futimesat +__NR_futimesat, +#endif +__NR_utimensat, +#ifdef __NR_utimensat_time64 +__NR_utimensat_time64, +#endif +#ifdef __NR_file_setattr +__NR_file_setattr, +#endif
include/asm-generic/audit_read.h +19 -0
@@ -3,6 +3,9 @@ __NR_readlink, #endif __NR_quotactl, +#ifdef __NR_quotactl_fd +__NR_quotactl_fd, +#endif __NR_listxattr, #ifdef __NR_listxattrat __NR_listxattrat,
@@ -18,3 +21,19 @@ __NR_fgetxattr,#ifdef __NR_readlinkat __NR_readlinkat,#endif +#ifdef __NR_file_getattr +__NR_file_getattr, +#endif +#ifdef __NR_stat +__NR_stat, +#endif +#ifdef __NR_lstat +__NR_lstat, +#endif +#ifdef __NR_fstat +__NR_fstat, +#endif +#ifdef __NR_newfstatat +__NR_newfstatat, +#endif +__NR_statx,
include/asm-generic/audit_write.h +3 -0
@@ -5,6 +5,9 @@ __NR_acct, __NR_swapon, #endif __NR_quotactl, +#ifdef __NR_quotactl_fd +__NR_quotactl_fd, +#endif #ifdef __NR_truncate __NR_truncate,#endif
Signature · 1 line
2.53.0
Arnd Bergmann
maintainerQuoted 15 lines · Ricardo Robaina
include/asm-generic/audit_read.h +6
-0@@ -18,3 +21,19 @@ __NR_fgetxattr,#ifdef __NR_readlinkat __NR_readlinkat,#endif +#ifdef __NR_file_getattr +__NR_file_getattr, +#endif +#ifdef __NR_stat +__NR_stat, +#endif
include/asm-generic/audit_read.h __NR_fgetxattr, · line 39
Quoted 10 lines
include/asm-generic/audit_read.h +10
-0+#ifdef __NR_lstat +__NR_lstat, +#endif +#ifdef __NR_fstat +__NR_fstat, +#endif +#ifdef __NR_newfstatat +__NR_newfstatat, +#endif +__NR_statx,
There are additional variants of 'stat' that I think you need to cover here:
scripts/syscall.tbl:79 stat64 fstatat64 sys_fstatat64scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_statarch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstatarch/x86/entry/syscalls/syscall_32.tbl:84 i386 oldlstat sys_lstatarch/x86/entry/syscalls/syscall_32.tbl:195 i386 stat64 sys_stat64 compat_sys_ia32_stat64arch/x86/entry/syscalls/syscall_32.tbl:196 i386 lstat64 sys_lstat64 compat_sys_ia32_lstat64arch/x86/entry/syscalls/syscall_32.tbl:197 i386 fstat64 sys_fstat64 compat_sys_ia32_fstat64arch/x86/entry/syscalls/syscall_32.tbl:300 i386 fstatat64 sys_fstatat64 compat_sys_ia32_fstatat64arch/alpha/kernel/syscalls/syscall.tbl:224 common osf_stat sys_osf_statarch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstatarch/alpha/kernel/syscalls/syscall.tbl:226 common osf_fstat sys_osf_fstat
Not sure about ustat/fstatfs/statfs, I suppose those are a different category, right?
Arnd
Quoted 31 lines · Arnd Bergmann
Quoted 15 lines · Ricardo Robaina
include/asm-generic/audit_read.h +6
-0@@ -18,3 +21,19 @@ __NR_fgetxattr,#ifdef __NR_readlinkat __NR_readlinkat,#endif +#ifdef __NR_file_getattr +__NR_file_getattr, +#endif +#ifdef __NR_stat +__NR_stat, +#endif include/asm-generic/audit_read.h __NR_fgetxattr, · line 39
Quoted 10 lines
include/asm-generic/audit_read.h +10
-0+#ifdef __NR_lstat +__NR_lstat, +#endif +#ifdef __NR_fstat +__NR_fstat, +#endif +#ifdef __NR_newfstatat +__NR_newfstatat, +#endif +__NR_statx,There are additional variants of 'stat' that I think you need to cover here:
Quoted 13 lines
scripts/syscall.tbl:79 stat64 fstatat64 sys_fstatat64 scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_stat arch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstat arch/x86/entry/syscalls/syscall_32.tbl:84 i386 oldlstat sys_lstat arch/x86/entry/syscalls/syscall_32.tbl:195 i386 stat64 sys_stat64 compat_sys_ia32_stat64 arch/x86/entry/syscalls/syscall_32.tbl:196 i386 lstat64 sys_lstat64 compat_sys_ia32_lstat64 arch/x86/entry/syscalls/syscall_32.tbl:197 i386 fstat64 sys_fstat64 compat_sys_ia32_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:300 i386 fstatat64 sys_fstatat64 compat_sys_ia32_fstatat64 arch/alpha/kernel/syscalls/syscall.tbl:224 common osf_stat sys_osf_stat arch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstat arch/alpha/kernel/syscalls/syscall.tbl:226 common osf_fstat sys_osf_fstat
Hi Arnd,
Thanks for reviewing this patch! You're right, it seems all these stat variants should be added as well. Steve and Paul, correct me if I'm wrong here, please.
Quoted 2 lines
Not sure about ustat/fstatfs/statfs, I suppose those are a different category, right?
Yes, I believe these would fall under a different category, since they are related to filesystem stats. Audit PERM classes are specifically for file metadata and access operations, not filesystem statistics
Quoted 3 lines
Arnd
I will work on v2 shortly.
Thanks,
-Ricardo
Quoted 53 lines · Eastern Daylight Time Ricardo Robaina
Quoted 48 lines · Arnd Bergmann
Quoted 17 lines · Ricardo Robaina
include/asm-generic/audit_read.h +6
-0@@ -18,3 +21,19 @@ __NR_fgetxattr,#ifdef __NR_readlinkat __NR_readlinkat,#endif +#ifdef __NR_file_getattr +__NR_file_getattr, +#endif +#ifdef __NR_stat +__NR_stat, +#endif include/asm-generic/audit_read.h __NR_fgetxattr, · line 39
Quoted 10 lines
include/asm-generic/audit_read.h +10
-0+#ifdef __NR_lstat +__NR_lstat, +#endif +#ifdef __NR_fstat +__NR_fstat, +#endif +#ifdef __NR_newfstatat +__NR_newfstatat, +#endif +__NR_statx,There are additional variants of 'stat' that I think you need to cover here:
scripts/syscall.tbl:79stat64 fstatat64sys_fstatat64 scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_stat arch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstat arch/x86/entry/syscalls/syscall_32.tbl:84 i386oldlstat
sys_lstatarch/x86/entry/syscalls/syscall_32.tbl:195i386 stat64
sys_stat64compat_sys_ia32_stat64arch/x86/entry/syscalls/syscall_32.tbl:196i386 lstat64
sys_lstat64compat_sys_ia32_lstat64arch/x86/entry/syscalls/syscall_32.tbl:197i386 fstat64
sys_fstat64compat_sys_ia32_fstat64arch/x86/entry/syscalls/syscall_32.tbl:300i386 fstatat64
sys_fstatat64compat_sys_ia32_fstatat64arch/alpha/kernel/syscalls/syscall.tbl:224commonosf_statQuoted 4 lines
sys_osf_stat arch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstat
arch/alpha/kernel/syscalls/syscall.tbl:226commonosf_fstat
sys_osf_fstat
Quoted 5 lines
Hi Arnd,
Thanks for reviewing this patch! You're right, it seems all these stat variants should be added as well. Steve and Paul, correct me if I'm wrong here, please.
Alpha is unsupported. Those are True64 compatibility syscalls. You can include it and #ifdef will filter it everywhere else. But, yeah. I guess the rest are ok. I don't pay much attention to the 32 bit arches.
-Steve
Quoted 58 lines · Steve Grubb
Quoted 55 lines · Eastern Daylight Time Ricardo Robaina
Quoted 48 lines · Arnd Bergmann
Quoted 17 lines · Ricardo Robaina
include/asm-generic/audit_read.h +6
-0@@ -18,3 +21,19 @@ __NR_fgetxattr,#ifdef __NR_readlinkat __NR_readlinkat,#endif +#ifdef __NR_file_getattr +__NR_file_getattr, +#endif +#ifdef __NR_stat +__NR_stat, +#endif include/asm-generic/audit_read.h __NR_fgetxattr, · line 39
Quoted 10 lines
include/asm-generic/audit_read.h +10
-0+#ifdef __NR_lstat +__NR_lstat, +#endif +#ifdef __NR_fstat +__NR_fstat, +#endif +#ifdef __NR_newfstatat +__NR_newfstatat, +#endif +__NR_statx,There are additional variants of 'stat' that I think you need to cover here:
scripts/syscall.tbl:79stat64 fstatat64sys_fstatat64 scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_stat arch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstat arch/x86/entry/syscalls/syscall_32.tbl:84 i386oldlstat
sys_lstatarch/x86/entry/syscalls/syscall_32.tbl:195i386 stat64
sys_stat64compat_sys_ia32_stat64arch/x86/entry/syscalls/syscall_32.tbl:196i386 lstat64
sys_lstat64compat_sys_ia32_lstat64arch/x86/entry/syscalls/syscall_32.tbl:197i386 fstat64
sys_fstat64compat_sys_ia32_fstat64arch/x86/entry/syscalls/syscall_32.tbl:300i386 fstatat64
sys_fstatat64compat_sys_ia32_fstatat64arch/alpha/kernel/syscalls/syscall.tbl:224commonosf_statQuoted 4 lines
sys_osf_stat arch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstat
arch/alpha/kernel/syscalls/syscall.tbl:226commonosf_fstat
sys_osf_fstatHi Arnd,
Quoted 7 lines
Quoted 3 lines
Thanks for reviewing this patch! You're right, it seems all these stat variants should be added as well. Steve and Paul, correct me if I'm wrong here, please.
Alpha is unsupported. Those are True64 compatibility syscalls. You can include it and #ifdef will filter it everywhere else. But, yeah. I guess the rest are ok. I don't pay much attention to the 32 bit arches.
Thanks, Steve.
Quoted 4 lines
-Steve
Arnd Bergmann
maintainerQuoted 25 lines · Steve Grubb
Quoted 22 lines · Eastern Daylight Time Ricardo Robaina
Quoted 16 lines
scripts/syscall.tbl:79stat64 fstatat64sys_fstatat64 scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_stat arch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstat arch/x86/entry/syscalls/syscall_32.tbl:84 i386oldlstat
sys_lstatarch/x86/entry/syscalls/syscall_32.tbl:195i386 stat64
sys_stat64compat_sys_ia32_stat64arch/x86/entry/syscalls/syscall_32.tbl:196i386 lstat64
sys_lstat64compat_sys_ia32_lstat64arch/x86/entry/syscalls/syscall_32.tbl:197i386 fstat64
sys_fstat64compat_sys_ia32_fstat64arch/x86/entry/syscalls/syscall_32.tbl:300i386 fstatat64
sys_fstatat64compat_sys_ia32_fstatat64arch/alpha/kernel/syscalls/syscall.tbl:224commonosf_statQuoted 4 lines
sys_osf_stat arch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstat
arch/alpha/kernel/syscalls/syscall.tbl:226commonosf_fstat
sys_osf_fstatHi Arnd,
Quoted 7 lines
Quoted 3 lines
Thanks for reviewing this patch! You're right, it seems all these stat variants should be added as well. Steve and Paul, correct me if I'm wrong here, please.
Alpha is unsupported. Those are True64 compatibility syscalls. You can include it and #ifdef will filter it everywhere else. But, yeah. I guess the rest are ok. I don't pay much attention to the 32 bit arches.
Ah, indeed. I assumed that these were part of the syscalls that originally came from osf1 but are still used on Linux systems, but it appears that the stat family was never used like that with glibc.
The oldstat family is actually in a similar category, as those were only used on libc5 or earlier. stat64 is definitely still needed on 32-bit userspace with 32-bit time_t.
Arnd
Quoted 40 lines · Arnd Bergmann
Quoted 25 lines · Steve Grubb
Quoted 22 lines · Eastern Daylight Time Ricardo Robaina
Quoted 16 lines
scripts/syscall.tbl:79stat64 fstatat64sys_fstatat64 scripts/syscall.tbl:80 stat64 fstat64 sys_fstat64 arch/x86/entry/syscalls/syscall_32.tbl:18 i386 oldstat sys_stat arch/x86/entry/syscalls/syscall_32.tbl:28 i386 oldfstat sys_fstat arch/x86/entry/syscalls/syscall_32.tbl:84 i386oldlstat
sys_lstatarch/x86/entry/syscalls/syscall_32.tbl:195i386 stat64
sys_stat64compat_sys_ia32_stat64arch/x86/entry/syscalls/syscall_32.tbl:196i386 lstat64
sys_lstat64compat_sys_ia32_lstat64arch/x86/entry/syscalls/syscall_32.tbl:197i386 fstat64
sys_fstat64compat_sys_ia32_fstat64arch/x86/entry/syscalls/syscall_32.tbl:300i386 fstatat64
sys_fstatat64compat_sys_ia32_fstatat64arch/alpha/kernel/syscalls/syscall.tbl:224commonosf_statQuoted 4 lines
sys_osf_stat arch/alpha/kernel/syscalls/syscall.tbl:225 common osf_lstat sys_osf_lstat
arch/alpha/kernel/syscalls/syscall.tbl:226commonosf_fstat
sys_osf_fstatHi Arnd,
Quoted 7 lines
Quoted 3 lines
Thanks for reviewing this patch! You're right, it seems all these stat variants should be added as well. Steve and Paul, correct me if I'm wrong here, please.
Alpha is unsupported. Those are True64 compatibility syscalls. You can include it and #ifdef will filter it everywhere else. But, yeah. I guess the rest are ok. I don't pay much attention to the 32 bit arches.
Ah, indeed. I assumed that these were part of the syscalls that originally came from osf1 but are still used on Linux systems, but it appears that the stat family was never used like that with glibc.
Quoted 6 lines
The oldstat family is actually in a similar category, as those were only used on libc5 or earlier. stat64 is definitely still needed on 32-bit userspace with 32-bit
time_t.Arnd
Thanks for the context, Arnd and Steve. I'll append just stat64, lstat64, fstat64 and fstatat64 to the v2 I'm about to send, then.
Please let me know if there's anything else to adjust.
-Ricardo
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Ricardo,
kernel test robot noticed the following build errors:
[auto build test ERROR on pcmoore-audit/next]
[also build test ERROR on linus/master v7.1-rc7 next-20260610] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ricardo-Robaina/audit-add-missing-syscalls-to-PERM-class-tables/20260611-024240 base: https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next patch link: https://lore.kernel.org/r/20260610164719.2668906-1-rrobaina%40redhat.com patch subject: [PATCH] audit: add missing syscalls to PERM class tables config: riscv-randconfig-001-20260611 (https://download.01.org/0day-ci/archive/20260612/[email protected]/config) compiler: riscv32-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260612/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from lib/audit.c:23:
>> include/asm-generic/audit_change_attr.h:52:1: error: '__NR_utimensat' undeclared here (not in a function); did you mean 'vfs_utimes'?
__NR_utimensat,
^~~~~~~~~~~~~~
vfs_utimesvim +52 include/asm-generic/audit_change_attr.h
> 52 __NR_utimensat,
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki