Commit 7ea6600148c265b1fd53e521022b1d7aec81d974
Committed by
Linus Torvalds
1 parent
9a7262a056
Exists in
master
and in
4 other branches
generic_permission: MAY_OPEN is not write access
generic_permission was refusing CAP_DAC_READ_SEARCH-enabled processes from opening DAC-protected files read-only, because do_filp_open adds MAY_OPEN to the open mask. Ignore MAY_OPEN. After this patch, CAP_DAC_READ_SEARCH is again sufficient to open(fname, O_RDONLY) on a file to which DAC otherwise refuses us read permission. Reported-by: Mike Kazantsev <mk.fraggod@gmail.com> Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Tested-by: Mike Kazantsev <mk.fraggod@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -232,6 +232,7 @@ |
232 | 232 | /* |
233 | 233 | * Searching includes executable on directories, else just read. |
234 | 234 | */ |
235 | + mask &= MAY_READ | MAY_WRITE | MAY_EXEC; | |
235 | 236 | if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) |
236 | 237 | if (capable(CAP_DAC_READ_SEARCH)) |
237 | 238 | return 0; |