[PATCH v2] fs: don't let getdents return bogus names

2018-07-31 Thread Jann Horn
When you e.g. run `find` on a directory for which getdents returns "filenames" that contain slashes, `find` passes those "filenames" back to the kernel, which then interprets them as paths. That could conceivably cause userspace to do something bad when accessing something like an untrusted USB

Re: [PATCH v2] fs: don't let getdents return bogus names

2018-07-31 Thread Al Viro
On Tue, Jul 31, 2018 at 06:10:27PM +0200, Jann Horn wrote: > +/* > + * Most filesystems don't filter out bogus directory entry names, and > userspace > + * can get very confused by such names. Behave as if a low-level IO error had > + * happened while reading directory entries. > + */ > +bool

Re: [PATCH v2] fs: don't let getdents return bogus names

2018-07-31 Thread Jann Horn
On Tue, Jul 31, 2018 at 6:51 PM Al Viro wrote: > > On Tue, Jul 31, 2018 at 06:10:27PM +0200, Jann Horn wrote: > > +/* > > + * Most filesystems don't filter out bogus directory entry names, and > > userspace > > + * can get very confused by such names. Behave as if a low-level IO error > > had >