On Tue, Mar 09, 2021 at 10:30:23AM -0800, Eric Biggers wrote:
Yes. 0 from readdir means "no more stuff", not an error.--- a/fs/proc/base.cIs there something in particular that makes you think that returning ENOENT is
+++ 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);
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.