Merge tag 'seccomp-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull seccomp updates from Kees Cook: "A couple of seccomp updates. They're both mostly bug fixes that I wanted to have sit in linux-next for a while: - allow TSYNC and USER_NOTIF together (Tycho Andersen) - add missing compat_ioctl for notify (Sven Schnelle)" * tag 'seccomp-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: seccomp: Add missing compat_ioctl for notify seccomp: allow TSYNC and USER_NOTIF together
This commit is contained in:
@@ -528,8 +528,12 @@ static long seccomp_attach_filter(unsigned int flags,
|
||||
int ret;
|
||||
|
||||
ret = seccomp_can_sync_threads();
|
||||
if (ret)
|
||||
return ret;
|
||||
if (ret) {
|
||||
if (flags & SECCOMP_FILTER_FLAG_TSYNC_ESRCH)
|
||||
return -ESRCH;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set log flag, if present. */
|
||||
@@ -1221,6 +1225,7 @@ static const struct file_operations seccomp_notify_ops = {
|
||||
.poll = seccomp_notify_poll,
|
||||
.release = seccomp_notify_release,
|
||||
.unlocked_ioctl = seccomp_notify_ioctl,
|
||||
.compat_ioctl = seccomp_notify_ioctl,
|
||||
};
|
||||
|
||||
static struct file *init_listener(struct seccomp_filter *filter)
|
||||
@@ -1288,10 +1293,12 @@ static long seccomp_set_mode_filter(unsigned int flags,
|
||||
* In the successful case, NEW_LISTENER returns the new listener fd.
|
||||
* But in the failure case, TSYNC returns the thread that died. If you
|
||||
* combine these two flags, there's no way to tell whether something
|
||||
* succeeded or failed. So, let's disallow this combination.
|
||||
* succeeded or failed. So, let's disallow this combination if the user
|
||||
* has not explicitly requested no errors from TSYNC.
|
||||
*/
|
||||
if ((flags & SECCOMP_FILTER_FLAG_TSYNC) &&
|
||||
(flags & SECCOMP_FILTER_FLAG_NEW_LISTENER))
|
||||
(flags & SECCOMP_FILTER_FLAG_NEW_LISTENER) &&
|
||||
((flags & SECCOMP_FILTER_FLAG_TSYNC_ESRCH) == 0))
|
||||
return -EINVAL;
|
||||
|
||||
/* Prepare the new filter before holding any locks. */
|
||||
|
Reference in New Issue
Block a user