Merge tag 'selinux-pr-20190917' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux updates from Paul Moore: - Add LSM hooks, and SELinux access control hooks, for dnotify, fanotify, and inotify watches. This has been discussed with both the LSM and fs/notify folks and everybody is good with these new hooks. - The LSM stacking changes missed a few calls to current_security() in the SELinux code; we fix those and remove current_security() for good. - Improve our network object labeling cache so that we always return the object's label, even when under memory pressure. Previously we would return an error if we couldn't allocate a new cache entry, now we always return the label even if we can't create a new cache entry for it. - Convert the sidtab atomic_t counter to a normal u32 with READ/WRITE_ONCE() and memory barrier protection. - A few patches to policydb.c to clean things up (remove forward declarations, long lines, bad variable names, etc) * tag 'selinux-pr-20190917' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: lsm: remove current_security() selinux: fix residual uses of current_security() for the SELinux blob selinux: avoid atomic_t usage in sidtab fanotify, inotify, dnotify, security: add security hook for fs notifications selinux: always return a secid from the network caches if we find one selinux: policydb - rename type_val_to_struct_array selinux: policydb - fix some checkpatch.pl warnings selinux: shuffle around policydb.c to get rid of forward declarations
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/memcontrol.h>
|
||||
#include <linux/security.h>
|
||||
|
||||
#include "inotify.h"
|
||||
#include "../fdinfo.h"
|
||||
@@ -331,7 +332,8 @@ static const struct file_operations inotify_fops = {
|
||||
/*
|
||||
* find_inode - resolve a user-given path to a specific inode
|
||||
*/
|
||||
static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags)
|
||||
static int inotify_find_inode(const char __user *dirname, struct path *path,
|
||||
unsigned int flags, __u64 mask)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -340,8 +342,15 @@ static int inotify_find_inode(const char __user *dirname, struct path *path, uns
|
||||
return error;
|
||||
/* you can only watch an inode if you have read permissions on it */
|
||||
error = inode_permission(path->dentry->d_inode, MAY_READ);
|
||||
if (error) {
|
||||
path_put(path);
|
||||
return error;
|
||||
}
|
||||
error = security_path_notify(path, mask,
|
||||
FSNOTIFY_OBJ_TYPE_INODE);
|
||||
if (error)
|
||||
path_put(path);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -733,7 +742,8 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
|
||||
if (mask & IN_ONLYDIR)
|
||||
flags |= LOOKUP_DIRECTORY;
|
||||
|
||||
ret = inotify_find_inode(pathname, &path, flags);
|
||||
ret = inotify_find_inode(pathname, &path, flags,
|
||||
(mask & IN_ALL_EVENTS));
|
||||
if (ret)
|
||||
goto fput_and_out;
|
||||
|
||||
|
Reference in New Issue
Block a user