linux-next: manual merge of the akpm-current tree with the vfs tree
Subsystems (2)
Hi Andrew,
Today's linux-next merge of the akpm-current tree got a conflict in fs/anon_inodes.c between commit 24b0303e9532 ("take anon inode allocation to libfs.c") from the vfs tree and commit 02f3ac4386d9 ("anon_inodefs:
forbid open via /proc") from the akpm-current tree.
I just dropped the akpm-current changes for today - they should probably be applied to fs/libfs.c.
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
Quoted 10 lines · Stephen Rothwell
Hi Andrew,
Today's linux-next merge of the akpm-current tree got a conflict in
fs/anon_inodes.cbetween commit24b0303e9532("take anon inode allocation tolibfs.c") from the vfs tree and commit02f3ac4386d9("anon_inodefs:
forbid open via /proc") from the akpm-current tree.I just dropped the akpm-current changes for today - they should probably be applied to
fs/libfs.c.
Well, this probably means that
anon_inodefs-forbid-open-via-proc.patch
should be dropped. I'll rediff this patch against vfs.git
Oleg.
Quoted 10 lines · Oleg Nesterov
Quoted 8 lines · Stephen Rothwell
Hi Andrew,
Today's linux-next merge of the akpm-current tree got a conflict in
fs/anon_inodes.cbetween commit24b0303e9532("take anon inode allocation tolibfs.c") from the vfs tree and commit02f3ac4386d9("anon_inodefs:
forbid open via /proc") from the akpm-current tree.
Quoted 8 lines
Quoted 2 lines
I just dropped the akpm-current changes for today - they should probably be applied to
fs/libfs.c.Well, this probably means that
anon_inodefs-forbid-open-via-proc.patch
should be dropped. I'll rediff this patch against vfs.git
24b0303e9532 also removes anon_inode_fops. It seems that it was not really needed anyway, inode_init_always() does inode->i_fop = empty_fops...
So probably we can simply change empty_fops but I need to recheck.
Oleg.
fs/inode.c +8 -1
@@ -114,6 +114,11 @@ int proc_nr_inodes(ctl_table *table, int }#endif +static int empty_open (struct inode *inode,struct file *file) +{ +return -ENXIO ; +} +/** * inode_init_always - perform inode structure intialisation * @sb: superblock inode belongs to
@@ -125,7 +130,9 @@ int proc_nr_inodes(ctl_table *table, intint inode_init_always (struct super_block *sb,struct inode *inode) {static const struct inode_operations empty_iops; -static const struct file_operations empty_fops; +static const struct file_operations empty_fops = { + .open = empty_open, + };struct address_space *const mapping = &inode->i_data; inode->i_sb = sb;
cover fs: forbid to open anon-inode files via /proc
Quoted 17 lines · Oleg Nesterov
Quoted 15 lines · Oleg Nesterov
Quoted 10 lines · Stephen Rothwell
Hi Andrew,
Today's linux-next merge of the akpm-current tree got a conflict in
fs/anon_inodes.cbetween commit24b0303e9532("take anon inode allocation tolibfs.c") from the vfs tree and commit02f3ac4386d9("anon_inodefs:
forbid open via /proc") from the akpm-current tree.I just dropped the akpm-current changes for today - they should probably be applied to
fs/libfs.c.Well, this probably means that
Quoted 8 lines
Quoted 3 lines
anon_inodefs-forbid-open-via-proc.patch
should be dropped. I'll rediff this patch against vfs.git
24b0303e9532also removesanon_inode_fops. It seems that it was not really needed anyway,inode_init_always()doesinode->i_fop=empty_fops...So probably we can simply change
empty_fopsbut I need to recheck.
Well. It looks "really obvious" that any user of inode_init_always() either needs to change ->i_fop or this file should not be opened via /proc...
So, Al, feel free to ignore, this is minor. Still I think this patch makes sense. Based on vfs.git#for-next.
Oleg.
PATCH 1/1 fs: forbid to open anon-inode files via /proc
open("/proc/pid/$anon-fd") should fail, we can't create the new file with correctly. Currently this creates the bogus file with ->f_op == empty_fops copied from ->i_fop, this is harmless but still wrong and misleading.
Now that anon_inode_fops has gone away we can add empty_no_open() to disallow this. This affects anon_inode_getfile() and the new aio_private_file().
--- fs/inode.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
fs/inode.c +8 -1
@@ -114,6 +114,11 @@ int proc_nr_inodes(ctl_table *table, int write, }#endif +static int empty_no_open (struct inode *inode,struct file *file) +{ +return -ENXIO ; +} +/** * inode_init_always - perform inode structure intialisation * @sb: superblock inode belongs to
@@ -124,8 +129,10 @@ int proc_nr_inodes(ctl_table *table, int write,*/ int inode_init_always (struct super_block *sb,struct inode *inode) { +static const struct file_operations empty_fops = { + .open = empty_no_open, + };static const struct inode_operations empty_iops; -static const struct file_operations empty_fops;struct address_space *const mapping = &inode->i_data; inode->i_sb = sb;
Signature · 1 line
1.5.5.1