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]
Message-ID: <YEfG54xMM7OtPEE5@localhost.localdomain>
Date:   Tue, 9 Mar 2021 22:05:11 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     Jia-Ju Bai <baijiaju1990@...il.com>, christian@...uner.io,
        ebiederm@...ssion.com, akpm@...ux-foundation.org,
        keescook@...omium.org, gladkov.alexey@...il.com, walken@...gle.com,
        bernd.edlinger@...mail.de, avagin@...il.com, deller@....de,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] fs: proc: fix error return code of
 proc_map_files_readdir()

On Tue, Mar 09, 2021 at 10:30:23AM -0800, Eric Biggers wrote:
> On Tue, Mar 09, 2021 at 01:55:27AM -0800, Jia-Ju Bai wrote:
> > When get_task_mm() returns NULL to mm, no error return code of
> > proc_map_files_readdir() is assigned.
> > To fix this bug, ret is assigned with -ENOENT in this case.

> > --- a/fs/proc/base.c
> > +++ b/fs/proc/base.c
> > @@ -2332,8 +2332,10 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
> >  		goto out_put_task;
> >  
> >  	mm = get_task_mm(task);
> > -	if (!mm)
> > +	if (!mm) {
> > +		ret = -ENOENT;
> >  		goto out_put_task;
> > +	}
> >  
> >  	ret = mmap_read_lock_killable(mm);
> 
> Is there something in particular that makes you think that returning ENOENT is
> the correct behavior in this case?  Try 'ls /proc/$pid/map_files' where pid is a
> kernel thread; it's an empty directory, which is probably intentional.  Your
> patch would change reading the directory to fail with ENOENT.

Yes. 0 from readdir means "no more stuff", not an error.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ