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, 12 Dec 2012 02:56:47 +0100
From:	"Hans J. Koch" <hjk@...sjkoch.de>
To:	Greg KH <gregkh@...uxfoundation.org>
Cc:	Benedikt Spranger <b.spranger@...utronix.de>,
	linux-kernel@...r.kernel.org, hjk@...sjkoch.de,
	Alexander.Frank@...rspaecher.com
Subject: Re: [PATCH 1/2] uio: add warning to documentation

On Tue, Dec 11, 2012 at 03:18:16PM -0800, Greg KH wrote:
> On Wed, Dec 12, 2012 at 12:12:01AM +0100, Benedikt Spranger wrote:
> > The documentation has no clear statement to the POSIX 1003.1 mmap()
> > feature, wich allows open(), mmap(), close() while the mmaped pointer is valid.
> > The release() hook inveigled driver programmer to activate owermanagement
> > functuonality in the release hook. This may harm.
> > 
> > Signed-off-by: Benedikt Spranger <b.spranger@...utronix.de>
> > ---
> >  Documentation/DocBook/uio-howto.tmpl |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
> > index ac3d001..59a886d 100644
> > --- a/Documentation/DocBook/uio-howto.tmpl
> > +++ b/Documentation/DocBook/uio-howto.tmpl
> > @@ -499,8 +499,13 @@ device is actually used.
> >  <listitem><para>
> >  <varname>int (*release)(struct uio_info *info, struct inode *inode)
> >  </varname>: Optional. If you define your own
> > -<function>open()</function>, you will probably also want a custom
> > +<function>release()</function>, you will probably also want a custom
> >  <function>release()</function> function.
> 
> That sentance no longer makes sense.
> 
> > +</para><para>CAVE: The release hook may be processed, even if a mmap is aktive.
> 
> Huh?

I think that's right. You can successfully close() a device while userspace is still
using a mapping. If the driver doesn't prevent it, userspace will fail with a SIGBUS
when accessing the mapping the next time.

> 
> > +Disabling clocks or other powermanagement functionality may cause a system
> > +crash, hangup or other unwanted sideeffects.
> > +</para><para><emphasis>The mmap() function shall add an extra reference to the file associated with the file descriptor fildes which is not removed by a subsequent close() on that file descriptor. This reference shall be removed when there are no more mappings to the file.</emphasis></para><para>
> > +<link xlink:href="http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html">IEEE Std 1003.1, 2004 Edition, mmap()</link>
> 
> It's not up to us to document the mmap system call here, you should know
> how to use it if you write a program with it, right?

In general, I agree. But in this case, I don't think that this is an mmap()
feature well known to all programmers (In fact, I wasn't aware of that until
Bene told me).

Thanks,
Hans

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