Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-03 Thread Kees Cook
On Sat, Oct 03, 2020 at 03:55:51PM +0200, Greg Kroah-Hartman wrote: > On Fri, Oct 02, 2020 at 03:30:30PM -0700, Kees Cook wrote: > > On Wed, Sep 30, 2020 at 09:22:19PM -0700, Joe Perches wrote: > > > On Wed, 2020-09-30 at 21:17 -0700, Kees Cook wrote: > > > > On Wed, Sep 30, 2020 at 01:57:40PM

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-03 Thread Joe Perches
On Sat, 2020-10-03 at 15:55 +0200, Greg Kroah-Hartman wrote: > On Fri, Oct 02, 2020 at 03:30:30PM -0700, Kees Cook wrote: > > On Wed, Sep 30, 2020 at 09:22:19PM -0700, Joe Perches wrote: > > > On Wed, 2020-09-30 at 21:17 -0700, Kees Cook wrote: > > > > On Wed, Sep 30, 2020 at 01:57:40PM +0200,

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-03 Thread Greg Kroah-Hartman
On Fri, Oct 02, 2020 at 03:30:30PM -0700, Kees Cook wrote: > On Wed, Sep 30, 2020 at 09:22:19PM -0700, Joe Perches wrote: > > On Wed, 2020-09-30 at 21:17 -0700, Kees Cook wrote: > > > On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > > > > Kees, and Rafael, I don't know if you

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-02 Thread Kees Cook
On Wed, Sep 30, 2020 at 09:22:19PM -0700, Joe Perches wrote: > On Wed, 2020-09-30 at 21:17 -0700, Kees Cook wrote: > > On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > > > Kees, and Rafael, I don't know if you saw this proposal from Joe for > > > sysfs files, questions below:

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-02 Thread Kees Cook
On Thu, Oct 01, 2020 at 10:50:29PM +0200, Greg Kroah-Hartman wrote: > On Wed, Sep 30, 2020 at 09:17:03PM -0700, Kees Cook wrote: > > On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > > > Kees, and Rafael, I don't know if you saw this proposal from Joe for > > > sysfs files,

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-02 Thread Greg Kroah-Hartman
On Wed, Sep 30, 2020 at 06:58:53AM -0700, Joe Perches wrote: > On Wed, 2020-09-30 at 13:57 +0200, Greg Kroah-Hartman wrote: > > Kees, and Rafael, I don't know if you saw this proposal from Joe for > > sysfs files, questions below: > >

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-10-01 Thread Greg Kroah-Hartman
On Wed, Sep 30, 2020 at 09:17:03PM -0700, Kees Cook wrote: > On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > > Kees, and Rafael, I don't know if you saw this proposal from Joe for > > sysfs files, questions below: > > I'm a fan. I think the use of sprintf() in sysfs might

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 21:17 -0700, Kees Cook wrote: > On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > > Kees, and Rafael, I don't know if you saw this proposal from Joe for > > sysfs files, questions below: > > I'm a fan. I think the use of sprintf() in sysfs might have been

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-30 Thread Kees Cook
On Wed, Sep 30, 2020 at 01:57:40PM +0200, Greg Kroah-Hartman wrote: > Kees, and Rafael, I don't know if you saw this proposal from Joe for > sysfs files, questions below: I'm a fan. I think the use of sprintf() in sysfs might have been one of my earliest complaints about unsafe code patterns in

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 13:57 +0200, Greg Kroah-Hartman wrote: > Kees, and Rafael, I don't know if you saw this proposal from Joe for > sysfs files, questions below: https://lore.kernel.org/linux-pm/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git@perches.com/T/ > So I guess I'm asking

Re: [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-30 Thread Greg Kroah-Hartman
Kees, and Rafael, I don't know if you saw this proposal from Joe for sysfs files, questions below: On Wed, Sep 16, 2020 at 01:40:38PM -0700, Joe Perches wrote: > Output defects can exist in sysfs content using sprintf and snprintf. > > sprintf does not know the PAGE_SIZE maximum of the temporary

[PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-16 Thread Joe Perches
Output defects can exist in sysfs content using sprintf and snprintf. sprintf does not know the PAGE_SIZE maximum of the temporary buffer used for outputting sysfs content and it's possible to overrun the PAGE_SIZE buffer length. Add a generic sysfs_emit function that knows that the size of the