mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 14:23:49 +01:00
The return value of __secure_computing() currently uses 0 to indicate that a system call should be allowed, and -1 to indicate that it should be blocked/killed. This 0/-1 pattern is non-intuitive for a security check function and makes the control flow at the call sites less readable. Furthermore, any potential future changes to these return values would require a high-risk, error-prone audit of all its users across different architectures. Sanitize this logic by converting the return type of __secure_computing() to a proper boolean, where 'true' explicitly means 'allow' and 'false' means 'fail/deny'. Update all the two dozen or so call sites across the tree to align with this new boolean semantic. No functional changes are intended, as the callers still return -1 to the lower-level assembly entry code upon seccomp denial. Rename the function to __seccomp_permit_syscall() so that the purpose is entirely clear. [ tglx: Rename the function ] Suggested-by: Thomas Gleixner <[email protected]> Suggested-by: Mark Rutland <[email protected]> Signed-off-by: Jinjie Ruan <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]> Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Link: https://patch.msgid.link/[email protected]