summaryrefslogtreecommitdiff
path: root/rust/helpers
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-05-21 17:04:28 +0200
committerThomas Gleixner <tglx@linutronix.de>2025-06-13 18:36:39 +0200
commitb89732c8c8357487185f260a723a060b3476144e (patch)
treedd92dbcf19613d8249e8d33658c8d8ee3bb1169e /rust/helpers
parent19272b37aa4f83ca52bdf9c16d5d81bdd1354494 (diff)
selftests: Fix errno checking in syscall_user_dispatch test
Successful syscalls don't change errno, so checking errno is wrong to ensure that a syscall has failed. For example for the following sequence: prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x0, 0xff, 0); EXPECT_EQ(EINVAL, errno); prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x0, 0x0, &sel); EXPECT_EQ(EINVAL, errno); only the first syscall may fail and set errno, but the second may succeed and keep errno intact, and the check will falsely pass. Or if errno happened to be EINVAL before, even the first check may falsely pass. Also use EXPECT/ASSERT consistently. Currently there is an inconsistent mix without obvious reasons for usage of one or another. Fixes: 179ef035992e ("selftests: Add kselftest for syscall user dispatch") Signed-off-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/af6a04dbfef9af8570f5bab43e3ef1416b62699a.1747839857.git.dvyukov@google.com
Diffstat (limited to 'rust/helpers')
0 files changed, 0 insertions, 0 deletions