History

openat2: reject RESOLVE_BENEATH|RESOLVE_IN_ROOT

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.

Aleksa Sarai committed 6 years ago

Commit 398840f1 parent b6505451 file · +4 −0Browse files

Unified · Split

fs/open.c+4−0
@@ -1010,6 +1010,10 @@ inline int build_open_flags(const struct open_how *how, struct open_flags *op) · 1009 unmodified lines
10101010 if (how->resolve & ~VALID_RESOLVE_FLAGS)
10111011 return -EINVAL;
10121012
1013+ /* Scoping flags are mutually exclusive. */
1014+ if ((how->resolve & RESOLVE_BENEATH) && (how->resolve & RESOLVE_IN_ROOT))
1015+ return -EINVAL;
1016+
10131017 /* Deal with the mode. */
10141018 if (WILL_CREATE(flags)) {
10151019 if (how->mode & ~S_IALLUGO)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t