lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 19 Feb 2014 15:28:41 -0500
From:	Richard Guy Briggs <rgb@...hat.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	John Johansen <john.johansen@...onical.com>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, linux-audit@...hat.com,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH 4/5] audit: anchor all pid references in the initial pid
 namespace

On 13/12/30, Oleg Nesterov wrote:
> On 12/23, Richard Guy Briggs wrote:
> >
> > Store and log all PIDs with reference to the initial PID namespace and
> > use the access functions task_pid_nr() and task_tgid_nr() for task->pid
> > and task->tgid rather than access them directly.
> 
> At first glance this patch looks like a good cleanup, but...
> 
> > @@ -429,6 +429,19 @@ 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();
> > +		}
> 
> I do not really understand this change, but this doesn't matter, I do
> not understand audit.

Is this pid_t handed down from userspace a valid pid_t in its
namespace?  If not, generate an error.  If it is, store its global
pid_t for future comparisons.  It might be better to store a struct
task_struct * or a struct pid *, but then the comparison functions would
have to change too, along with the rule reporting functions, which still
report pid_t to userspace.

> However, I think this deserves a separate patch with the changelog.

All *that* would need a seperate patch...

> > @@ -278,9 +278,12 @@ static void dump_common_audit_data(struct audit_buffer *ab,
> >  	}
> >  	case LSM_AUDIT_DATA_TASK:
> >  		tsk = a->u.tsk;
> > -		if (tsk && tsk->pid) {
> > -			audit_log_format(ab, " pid=%d comm=", tsk->pid);
> > -			audit_log_untrustedstring(ab, tsk->comm);
> > +		if (tsk) {
> > +			pid_t pid = task_pid_nr(tsk);
> > +			if (pid) {
> > +				audit_log_format(ab, " pid=%d comm=", pid);
> > +				audit_log_untrustedstring(ab, tsk->comm);
> 
> Just curious, is it really possible that a->u.tsk is an idle thread?

No.  It is possible a->u.tsk isn't filled in.

> Oleg.

- RGB

--
Richard Guy Briggs <rbriggs@...hat.com>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ