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:   Fri, 26 Mar 2021 16:19:12 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     Greg KH <greg@...ah.com>, mingo@...nel.org, mgorman@...e.de,
        juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        bristot@...hat.com, joshdon@...gle.com, valentin.schneider@....com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 6/9] debugfs: Implement debugfs_create_str()

On Fri, Mar 26, 2021 at 03:58:37PM +0100, Rasmus Villemoes wrote:
> >   kmalloc(len + 2, ...);
> 
> No, because nul-terminating the stuff you pass to
> simple_read_from_buffer is pointless cargo-culting. Yeah, read_file_bool
> does it, but that's just bogus.

Urgh, feel yuck to not have it zero terminated, but if you feel strongly
about it I suppose I can make it go away.

> > 	len = strscpy(copy, str, len);
> > 	if (len < 0)
> > 		return len;
> 
> To what end? The only way that could possibly return -EFOO is if the
> nul-terminator in str vanished between the strlen() and here, and in
> that case you have bigger problems.

There are strings in the kernel which we rewrite in most ugly ways,
task_struct::comm comes to mind. Best be paranoid.

> > Copy-pasta from debugfs_*_bool(). This thing seems to export everything
> > and I figured I'd go along with that.
> 
> I thought the convention was not to export anything until the kernel
> itself had a (modular) user.

That's generally how I feel too. But this really isn't my subsystem so I
more or less try to mimmick what I see done there.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ