Skip to content

Commit

Permalink
fixup: audit: implement audit by executable
Browse files Browse the repository at this point in the history
The Intel build-bot detected a sparse warning with with a patch I posted a
couple of days ago that was accepted in the audit/next tree:

Subject: [linux-next:master 6689/6751] kernel/audit_watch.c:543:36: sparse: dereference of noderef expression
Date: Friday, August 07, 2015, 06:57:55 PM
From: kbuild test robot <[email protected]>
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   e6455bc
commit: 2e3a8ae [6689/6751] Merge remote- tracking branch 'audit/next'
sparse warnings: (new ones prefixed by >>)
>> kernel/audit_watch.c:543:36: sparse: dereference of noderef expression
   kernel/audit_watch.c:544:28: sparse: dereference of noderef expression

34d99af Richard Guy Briggs 2015-08-05  541  int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
34d99af Richard Guy Briggs 2015-08-05  542  {
34d99af Richard Guy Briggs 2015-08-05 @543     unsigned long ino = tsk->mm- >exe_file->f_inode->i_ino;
34d99af Richard Guy Briggs 2015-08-05  544     dev_t dev = tsk->mm->exe_file- >f_inode->i_sb->s_dev;

:::::: The code at line 543 was first introduced by commit
:::::: 34d99af audit: implement audit by executable

tsk->mm->exe_file requires RCU access.  The warning was reproduceable by adding
"C=1 CF=-D__CHECK_ENDIAN__" to the build command, and verified eliminated with
this patch.

Signed-off-by: Richard Guy Briggs <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
rgbriggs authored and pcmoore committed Aug 13, 2015
1 parent 34d99af commit 15ce414
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions kernel/audit_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,14 @@ int audit_dupe_exe(struct audit_krule *new, struct audit_krule *old)

int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
{
unsigned long ino = tsk->mm->exe_file->f_inode->i_ino;
dev_t dev = tsk->mm->exe_file->f_inode->i_sb->s_dev;

struct file *exe_file;
unsigned long ino;
dev_t dev;

rcu_read_lock();
exe_file = rcu_dereference(tsk->mm->exe_file);
ino = exe_file->f_inode->i_ino;
dev = exe_file->f_inode->i_sb->s_dev;
rcu_read_unlock();
return audit_mark_compare(mark, ino, dev);
}

0 comments on commit 15ce414

Please sign in to comment.