Skip to content

Commit

Permalink
audit: don't attempt to lookup PIDs when changing PID filtering audit…
Browse files Browse the repository at this point in the history
… rules

Commit f1dc486 ("audit: anchor all pid references in the initial pid
namespace") introduced a find_vpid() call when adding/removing audit
rules with PID/PPID filters; unfortunately this is problematic as
find_vpid() only works if there is a task with the associated PID
alive on the system.  The following commands demonstrate a simple
reproducer.

	# auditctl -D
	# auditctl -l
	# autrace /bin/true
	# auditctl -l

This patch resolves the problem by simply using the PID provided by
the user without any additional validation, e.g. no calls to check to
see if the task/PID exists.

Cc: [email protected] # 3.15
Cc: Richard Guy Briggs <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Acked-by: Eric Paris <[email protected]>
Reviewed-by: Richard Guy Briggs <[email protected]>
  • Loading branch information
pcmoore committed Dec 19, 2014
1 parent 0f7e94e commit 3640dcf
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions kernel/auditfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,6 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
f->val = 0;
}

if ((f->type == AUDIT_PID) || (f->type == AUDIT_PPID)) {
struct pid *pid;
rcu_read_lock();
pid = find_vpid(f->val);
if (!pid) {
rcu_read_unlock();
err = -ESRCH;
goto exit_free;
}
f->val = pid_nr(pid);
rcu_read_unlock();
}

err = audit_field_valid(entry, f);
if (err)
goto exit_free;
Expand Down

0 comments on commit 3640dcf

Please sign in to comment.