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]
Message-ID: <20100428153933.GA6610@redhat.com>
Date:	Wed, 28 Apr 2010 17:39:33 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	"Serge E. Hallyn" <serue@...ibm.com>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Ashwin Ganti <ashwin.ganti@...il.com>,
	David Howells <dhowells@...hat.com>, Greg KH <greg@...ah.com>,
	rsc@...ch.com, ericvh@...il.com,
	linux-security-module@...r.kernel.org,
	Ron Minnich <rminnich@...il.com>, jt.beard@...il.com,
	Andrew Morgan <morgan@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Eric Paris <eparis@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Randy Dunlap <rdunlap@...otime.net>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Kyle Moffett <kyle@...fetthome.net>,
	Steve Grubb <sgrubb@...hat.com>
Subject: Re: [PATCH 3/3] RFC: p9auth: add p9auth fs

On 04/28, Serge E. Hallyn wrote:
>
> Quoting Oleg Nesterov (oleg@...hat.com):
>
> > > +static ssize_t p9auth_use_write(struct file *file, const char __user *buffer,
> > > +			       size_t count, loff_t *ppos)
> > > +{
> > > +	ssize_t retval = -ENOMEM;
> > > +	char *user_buf;
> > > +
> > > +	if (mutex_lock_interruptible(&cap_mutex))
> > > +		return -EINTR;
> >
> > EINTR doesn't look exactly right here, especially if TIF_SIGPENDING is
> > spurious. Probably ERESTARTNOINTR makes more sense. Or mutex_lock_killable().
>
> Ashwin had had this as ERESTARTSYS I believe.  I'd read something about
> userspace should only see -EINTR so I changed it.

Yes, ERESTARTxxx should not be visible to the user-space. But it is OK
to return it from the syscall if signal_pending() is true, in this case
it will be changed to EINTR or the system call will be restarted.

ERESTARTNOINTR always restarts the syscall, perphaps after handling the
signal if it is really pending.

> > > +	if (copy_from_user(user_buf, buffer, count)) {
> > > +		retval = -EFAULT;
> > > +		goto out;
> > > +	}
> > > +
> > > +	retval = use_setuid_capability(user_buf);
> >
> > It seems that use_setuid_capability() pathes assume that user_buf is
> > null terminated? Say, parse_user_capability() does kstrdup(user_buf).
>
> I kzalloc()d to count+1 before, and only copy_from_user() count bytes,
> so the last byte should always be 0.

Ah, indeed, thanks.

Oleg.

--
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