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] [day] [month] [year] [list]
Date:   Fri, 15 Dec 2017 05:19:32 -0800
From:   Tejun Heo <tj@...nel.org>
To:     Christophe LEROY <christophe.leroy@....fr>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: sysfs_kf_seq_show() spends 87% of time in memset()

Hello,

On Fri, Dec 15, 2017 at 01:59:55PM +0100, Christophe LEROY wrote:
> Doing a 'perf record' on an application using GPIOs a lot, I
> discovered that most of the time spent in the read() system call of
> the 'value' sysfs file of that GPIO (which returns "0\n" or "1\n")
> is indeed spent in memset() zeroing a buffer of size PAGE_SIZE for a
> 2 bytes read:
...
> As far as I can see, that memset() was introduced by your commit
> f5c16f29bf5e5 ("sysfs: make sure read buffer is zeroed")
> 
> Is that really necessary, taking into account that the ->show will
> overwrite it ?

We were doing get_zeroed_pages() before, so the commit is restoring
the previous behavior, and, yeah, I think there's some risk of leaking
uninitialized data.  The way the ->show() interface is defined doesn't
give us a lot of leeway.  The right thing to do would be switching the
said driver to prealloc read or ->bin_read.

Thanks.

-- 
tejun

Powered by blists - more mailing lists