提交 7ea66001 编写于 作者: S Serge E. Hallyn 提交者: Linus Torvalds

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: NMike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: NSerge E. Hallyn <serue@us.ibm.com>
Tested-by: NMike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9a7262a0
......@@ -232,6 +232,7 @@ int generic_permission(struct inode *inode, int mask,
/*
* Searching includes executable on directories, else just read.
*/
mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE)))
if (capable(CAP_DAC_READ_SEARCH))
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册