audit: ignore fcaps on umount

Don't fetch fcaps when umount2 is called to avoid a process hang while
it waits for the missing resource to (possibly never) re-appear.

Note the comment above user_path_mountpoint_at():
 * A umount is a special case for path walking. We're not actually interested
 * in the inode in this situation, and ESTALE errors can be a problem.  We
 * simply want track down the dentry and vfsmount attached at the mountpoint
 * and avoid revalidating the last component.

This can happen on ceph, cifs, 9p, lustre, fuse (gluster) or NFS.

Please see the github issue tracker
https://github.com/linux-audit/audit-kernel/issues/100

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
[PM: merge fuzz in audit_log_fcaps()]
Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
Richard Guy Briggs 2019-01-23 13:35:00 -05:00 committed by Paul Moore
parent 05c7a9cb27
commit 57d4657716
7 changed files with 29 additions and 11 deletions

View file

@ -25,6 +25,7 @@
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/namei.h> /* LOOKUP_* */
#include <uapi/linux/audit.h>
#define AUDIT_INO_UNSET ((unsigned long)-1)
@ -248,6 +249,7 @@ extern void __audit_getname(struct filename *name);
#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
#define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */
extern void __audit_inode(struct filename *name, const struct dentry *dentry,
unsigned int flags);
extern void __audit_file(const struct file *);
@ -308,12 +310,15 @@ static inline void audit_getname(struct filename *name)
}
static inline void audit_inode(struct filename *name,
const struct dentry *dentry,
unsigned int parent) {
unsigned int flags) {
if (unlikely(!audit_dummy_context())) {
unsigned int flags = 0;
if (parent)
flags |= AUDIT_INODE_PARENT;
__audit_inode(name, dentry, flags);
unsigned int aflags = 0;
if (flags & LOOKUP_PARENT)
aflags |= AUDIT_INODE_PARENT;
if (flags & LOOKUP_NO_EVAL)
aflags |= AUDIT_INODE_NOEVAL;
__audit_inode(name, dentry, aflags);
}
}
static inline void audit_file(struct file *file)