openat2: reject RESOLVE_BENEATH|RESOLVE_IN_ROOT
authorAleksa Sarai <cyphar@cyphar.com>
Tue, 27 Oct 2020 23:50:43 +0000 (10:50 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:54:24 +0000 (11:54 +0100)
commitaa606ebab122a108c2af4304a6036fc5c87ee85e
tree6c66f36683ce504964484da1430e87328dc72173
parentda65881cecf536b9c4235ca70f044f94ab66e782
openat2: reject RESOLVE_BENEATH|RESOLVE_IN_ROOT

commit 398840f8bb935d33c64df4ec4fed77a7d24c267d upstream.

This was an oversight in the original implementation, as it makes no
sense to specify both scoping flags to the same openat2(2) invocation
(before this patch, the result of such an invocation was equivalent to
RESOLVE_IN_ROOT being ignored).

This is a userspace-visible ABI change, but the only user of openat2(2)
at the moment is LXC which doesn't specify both flags and so no
userspace programs will break as a result.

Fixes: fddb5d430ad9 ("open: introduce openat2(2) syscall")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <stable@vger.kernel.org> # v5.6+
Link: https://lore.kernel.org/r/20201027235044.5240-2-cyphar@cyphar.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/open.c