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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140923144650.2aa71b39@notabene.brown>
Date:	Tue, 23 Sep 2014 14:46:50 +1000
From:	NeilBrown <neilb@...e.de>
To:	Tejun Heo <tj@...nel.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernfs: use stack-buf for small writes.

On Tue, 23 Sep 2014 00:18:17 -0400 Tejun Heo <tj@...nel.org> wrote:

> On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote:
> ...
> > Note that reads from a sysfs file are already safe due to the use for
> > seqfile.  The first read will allocate a buffer (m->buf) which will
> > be used for all subsequent reads.
> 
> Hmmm?  How is seqfile safe?  Where would the seq op write to?

seqfile is only safe for reads.  sysfs via kernfs uses seq_read(), so there
is only a single allocation on the first read.

It doesn't really related to fixing writes, except to point out that only
writes need to be "fixed".  Reads already work.

Separately:

> Ugh... :( If this can't be avoided at all, I'd much prefer it to be
> something explicit - a flag marking the file as needing a persistent
> write buffer which is allocated on open.  "Small" writes on stack
> feels way to implicit to me.

How about if we add seq_getbuf() and seq_putbuf() to seqfile
which takes a 'struct seq_file' and a size and returns the ->buf
after making sure it is big enough.
It also claims and releases the seqfile ->lock.

Then we would be using the same buffer for reads and write.

Does that sound suitable?  It uses existing infrastructure and avoids having
to identify in advance which attributes it is important for.

Thanks,
NeilBrown

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ