We have recently enabled CONFIG_FANOTIFY=y in our testing builds and i386 kernel running on x86_64 machine testing LTP 20200515 test runs reported fanotify{01,02,04..15} failures on linux mainline 5.7.0-rc6 Where as these tests pass on x86_64, arm and arm64.
Is this a known issue on i386 ? As you know, these tests cases were skipped before enabling CONFIG_FANOTIFY.
The file system mounted on NFS and the LTP tests using a external mounted SSD drive. LTP tests running as
Steps to reproduce: ------------------- ./runltp -d /scratch -f syscalls
and easily reproducible on qemu_i386 also which is mounting local rootfs.img
configs: ----------- CONFIG_FANOTIFY=y # CONFIG_FANOTIFY_ACCESS_PERMISSIONS is not set --> not set of x86_64 and i386.
Test output log: ----------------- tst_device.c:262: INFO: Using test device LTP_DEV='/dev/loop0' tst_mkfs.c:90: INFO: Formatting /dev/loop0 with ext2 opts='' extra opts='' mke2fs 1.43.8 (1-Jan-2018) [ 391.914376] EXT4-fs (loop0): mounting ext2 file system using the ext4 subsystem [ 391.962316] EXT4-fs (loop0): mounted filesystem without journal. Opts: (null) [ 391.969684] ext2 filesystem being mounted at /scratch/ltp-86JZJboUf9/Sl4t1D/fs_mnt supports timestamps until 2038 (0x7fffffff) tst_test.c:1246: INFO: Timeout per run is 0h 15m 00s fanotify01.c:89: INFO: Test #0: inode mark events fanotify01.c:115: BROK: fanotify_mark (6, FAN_MARK_ADD, FAN_ACCESS | FAN_MARK_INODE | FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, fs_mnt/tfile_19115) failed: EFAULT (14)
fanotify02.c:57: BROK: fanotify_mark (6, FAN_MARK_ADD, FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN | FAN_EVENT_ON_CHILD | FAN_ONDIR, AT_FDCWD, '.') failed: EFAULT (14)
fanotify03.c:236: CONF: CONFIG_FANOTIFY_ACCESS_PERMISSIONS not configured in kernel?: EINVAL (22)
fanotify04.c:66: FAIL: fanotify_mark (6, FAN_MARK_ADD | FAN_MARK_ONLYDIR, FAN_OPEN, AT_FDCWD, '.') failed fanotify04.c:71: PASS: fanotify_mark (6, FAN_MARK_ADD | FAN_MARK_ONLYDIR, FAN_OPEN, AT_FDCWD, 'fname_19127') failed fanotify04.c:66: FAIL: fanotify_mark (6, FAN_MARK_ADD | FAN_MARK_DONT_FOLLOW, FAN_OPEN, AT_FDCWD, 'symlink_19127') failed fanotify04.c:66: FAIL: fanotify_mark (6, FAN_MARK_ADD | 0, FAN_OPEN, AT_FDCWD, 'symlink_19127') failed fanotify04.c:198: BROK: fanotify_mark (6, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD, 'fname_19127') failed: EFAULT (14)
fanotify05.c:115: BROK: fanotify_mark (6, FAN_MARK_MOUNT | FAN_MARK_ADD, FAN_OPEN, AT_FDCWD, ".") failed: EFAULT (14)
fanotify06.c:98: BROK: fanotify_mark(6, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_MODIFY, AT_FDCWD, mntpoint/tfile_19139) failed: EFAULT (14)
fanotify07.c:112: CONF: CONFIG_FANOTIFY_ACCESS_PERMISSIONS not configured in kernel?: EINVAL (22)
fanotify09.c:108: BROK: fanotify_mark(6, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_MODIFY, AT_FDCWD, '.') failed: EFAULT (14)
fanotify10.c:239: BROK: fanotify_mark(6, FAN_MARK_ADD | FAN_MARK_MOUNT,FAN_OPEN, AT_FDCWD, fs_mnt) failed: EFAULT (14)
fanotify11.c:82: BROK: fanotify_mark FAN_MARK_ADD fail ret=-1
fanotify12.c:160: BROK: fanotify_mark(6, FAN_MARK_ADD | FAN_MARK_INODE, 20, AT_FDCWD, fname_19160) failed: EFAULT (14)
fanotify13.c:300: BROK: fanotify_mark(6, FAN_MARK_ADD, FAN_CLOSE_WRITE, AT_FDCWD, mntpoint/file_one) failed: EFAULT (14)
fanotify15.c:101: BROK: fanotify_mark(6, FAN_MARK_ADD | FAN_MARK_FILESYSTEM, FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_MODIFY | FAN_ONDIR | 0x400, AT_FDCWD, mntpoint/test_dir) failed: EFAULT (14)
full test log link, i386 kernel running on x86_64 machine https://lkft.validation.linaro.org/scheduler/job/1446082#L8947 https://lkft.validation.linaro.org/scheduler/job/1457258#L8946
qemu_i386 test log link, https://lkft.validation.linaro.org/scheduler/job/1446103 https://qa-reports.linaro.org/lkft/linux-mainline-oe/build/v5.7-rc6-100-g444...
Test results comparison: https://qa-reports.linaro.org/lkft/linux-mainline-oe/tests/ltp-syscalls-test... https://qa-reports.linaro.org/lkft/linux-mainline-oe/tests/ltp-syscalls-test...
Hi!
fanotify01.c:115: BROK: fanotify_mark (6, FAN_MARK_ADD, FAN_ACCESS | FAN_MARK_INODE | FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, fs_mnt/tfile_19115) failed: EFAULT (14)
Looking at these failures we do not pass anything that may cause EFAULT, the only pointer we pass is the path at the end but that thing is null terminated properly. In a case of fanotify09.c it's even constant string.
On Mon, 1 Jun 2020 at 19:46, Cyril Hrubis chrubis@suse.cz wrote:
Hi!
fanotify01.c:115: BROK: fanotify_mark (6, FAN_MARK_ADD, FAN_ACCESS | FAN_MARK_INODE | FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, fs_mnt/tfile_19115) failed: EFAULT (14)
Looking at these failures we do not pass anything that may cause EFAULT, the only pointer we pass is the path at the end but that thing is null terminated properly. In a case of fanotify09.c it's even constant string.
The reported problem is only seen on i386 and qemu_i386 on Linus 's 5.8 and stable-rc 5.7 kernels.
Summary of LTP fanotify01 test results on i386 running 5.8 kernel version.
fanotify01: fail fanotify02: fail fanotify03: skip fanotify04: fail fanotify05: fail fanotify06: fail fanotify07: skip fanotify08: pass fanotify09: fail fanotify10: fail fanotify11: fail fanotify12: fail fanotify13: fail fanotify14: pass fanotify15: fail fanotify16: skip
Here is the strace output for more details please refer to the link below.
# cd /opt/ltp/testcases/bin # strace -f ./fanotify01
strace output snippet: ------------------ [pid 409] rt_sigaction(SIGALRM, {sa_handler=SIG_DFL, sa_mask=[ALRM], sa_flags=SA_RESTART}, <unfinished ...> [pid 401] waitpid(409, <unfinished ...> [pid 409] <... rt_sigaction resumed> {sa_handler=0x804fde0, sa_mask=[ALRM], sa_flags=SA_RESTART}, 8) = 0 [pid 409] rt_sigaction(SIGUSR1, {sa_handler=SIG_DFL, sa_mask=[USR1], sa_flags=SA_RESTART}, {sa_handler=0x804fcc0, sa_mask=[USR1], sa_flags=SA_RESTART}, 8) = 0 [pid 409] rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[INT], sa_flags=SA_RESTART}, {sa_handler=0x804fda0, sa_mask=[INT], sa_flags=SA_RESTART}, 8) = 0 [pid 409] setpgid(0, 0) = 0 [pid 409] clock_gettime(CLOCK_MONOTONIC, {tv_sec=8, tv_nsec=116015365}) = 0 [pid 409] getppid() = 401 [pid 409] kill(401, SIGUSR1) = 0 [pid 401] <... waitpid resumed> 0xbf9ffcac, 0) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) [pid 409] getpid( <unfinished ...> [pid 401] ---[ 8.214748] fanotify01 (409) used greatest stack depth: 5692 bytes left SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=409, si_uid=0} --- [pid 409] <... getpid resumed> ) = 409 [pid 401] alarm(300 <unfinished ...> [pid 409] fanotify_init(FAN_CLASS_NOTIF, O_RDONLY <unfinished ...> [pid 401] <... alarm resumed> ) = 300 [pid 409] <... fanotify_init resumed> ) = 3 [pid 401] sigreturn({mask=[]} <unfinished ...> [pid 409] close(3 <unfinished ...> [pid 401] <... sigreturn resumed> ) = 7 [pid 409] <... close resumed> ) = 0 [pid 401] waitpid(409, <unfinished ...> [pid 409] getpid() = 409 [pid 409] openat(AT_FDCWD, "fs_mnt/tfile_409", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 [pid 409] fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 [pid 409] write(3, "1", 1) = 1 [pid 409] close(3) = 0 [pid 409] getpid() = 409 [pid 409] write(2, "fanotify01.c:89: \33[1;34mINFO: \33["..., 61fanotify01.c:89: [1;34mINFO: [0mTest #0: inode mark events ) = 61 [pid 409] fanotify_init(FAN_CLASS_NOTIF, O_RDONLY) = 3 [pid 409] fanotify_mark(3, FAN_MARK_ADD, FAN_ACCESS|FAN_MODIFY|FAN_CLOSE_WRITE|FAN_CLOSE_NOWRITE|FAN_OPEN, AT_FDCWD, "fs_mnt/tfile_409") = -1 EFAULT (Bad address) [pid 409] write(2, "fanotify01.c:115: \33[1;31mBROK: \33"..., 180fanotify01.c:115: [1;31mBROK: [0mfanotify_mark (3, FAN_MARK_ADD, FAN_ACCESS | FAN_MARK_INODE | FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, fs_mnt/tfile_409) failed: EFAULT (14) ) = 180
Full strace test log link, https://lkft.validation.linaro.org/scheduler/job/1532479#L822
LTP syscalls run log, https://lkft.validation.linaro.org/scheduler/job/1530988#L8403
- Naresh