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, 24 Sep 2014 20:17:27 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	NeilBrown <neilb@...e.de>
Cc:	Tejun Heo <tj@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernfs: use stack-buf for small writes.

On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote:
> 
> For a write <= 128 characters, don't use kmalloc.
> 
> mdmon, part of mdadm, will sometimes need to write
> to a sysfs file in order to allow writes to the array
> to continue.  This is important to support RAID metadata
> types that the kernel doesn't know about.
> 
> It is important that this write doesn't block on
> memory allocation.  The safest way to ensure that is to
> use an on-stack buffer.

Is it, now?  What happens if caller of write(2) loses CPU and gets
the page it's writing from swapped out, just as it's getting to
issuing the actual syscall?  copy_from_user() will fault and cause
memory allocation for you...

> Writes are always small, typically less than 10 characters.

Translation: "but my userland code uses it _that_ way; surely, nobody
would do anything else..."
--
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