On Thu, Oct 29, 2020 at 12:30 PM Mickaël Salaün [off-list ref] wrote:
On 29/10/2020 02:06, Jann Horn wrote:
quoted
On Tue, Oct 27, 2020 at 9:04 PM Mickaël Salaün [off-list ref] wrote:
quoted
These 3 system calls are designed to be used by unprivileged processes
to sandbox themselves:
[...]
quoted
quoted
+ /*
+ * Similar checks as for seccomp(2), except that an -EPERM may be
+ * returned.
+ */
+ if (!task_no_new_privs(current)) {
+ err = security_capable(current_cred(), current_user_ns(),
+ CAP_SYS_ADMIN, CAP_OPT_NOAUDIT);
I think this should be ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN)?
Right. The main difference is that ns_capable*() set PF_SUPERPRIV in
current->flags. I guess seccomp should use ns_capable_noaudit() as well?
Yeah. That seccomp code is from commit e2cfabdfd0756, with commit date
in April 2012, while ns_capable_noaudit() was introduced in commit
98f368e9e263, with commit date in June 2016; the seccomp code predates
the availability of that API.
Do you want to send a patch to Kees for that, or should I?