device/*: share Linux 3.4 patch for elogind not starting (MR 1606)
This commit is contained in:
parent
813a78a74f
commit
ce501c83a2
18 changed files with 34 additions and 368 deletions
|
@ -1,4 +1,9 @@
|
|||
From 25437b2a54dd619a96e268ecaf303b089aa785e4 Mon Sep 17 00:00:00 2001
|
||||
This patch fixes elogind not starting with this error on 3.4 kernels:
|
||||
|
||||
elogind-daemon: Failed to determine whether /sys/fs/cgroup is a mount point: Symbolic link loop
|
||||
elogind-daemon: Failed to mount cgroup at /sys/fs/cgroup/elogind: No such file or directory
|
||||
|
||||
From cf9ab4c62be7837c2f007cd51ab3604ca0620070 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Mon, 4 Jun 2012 11:00:45 -0700
|
||||
Subject: [PATCH] vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
|
||||
|
@ -29,7 +34,6 @@ do apparently use this feature.
|
|||
does make sense, even if the pain it has caused means we probably
|
||||
shouldn't have done it to begin with. ]
|
||||
|
||||
Change-Id: I6499a97dc8993b3dd6b4df5af2724990ee91fd3b
|
||||
Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
|
@ -38,10 +42,10 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 2f198dad12c5..c8cb15dcca08 100644
|
||||
index 57b8159f26f3..9fc77b412ac4 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1838,7 +1838,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
@@ -1803,7 +1803,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
|
@ -50,7 +54,7 @@ index 2f198dad12c5..c8cb15dcca08 100644
|
|||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1854,12 +1854,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
@@ -1819,12 +1819,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +75,7 @@ index 2f198dad12c5..c8cb15dcca08 100644
|
|||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1894,6 +1896,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
@@ -1859,6 +1861,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
pkgname=linux-alcatel-pop7lte
|
||||
pkgver=3.4.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Alcatel OneTouch Pop 7S kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -33,7 +33,7 @@ source="
|
|||
kernel-use-the-gnu89-standard-explicitly.patch
|
||||
gcc10-extern_YYLOC_global_declaration.patch
|
||||
01_timeconst.patch
|
||||
fix-fdinfo-file-handling.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
0001-fix-video-argb-setting.patch
|
||||
"
|
||||
builddir="$srcdir/$_repository-$_commit"
|
||||
|
@ -67,5 +67,5 @@ a2ec4e3640a7f20454242c03ba80887e71c50fcbf38b36fd2d8f7163a96e69ade010431840504a43
|
|||
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
|
||||
a2bb98fb8d988bbb659cae00fbaca360828300e9b98b90aed5ee0dd839c3f740696df4094a9021b813cbada06820d115aabed581a47cdd2c947e8d853c20b145 01_timeconst.patch
|
||||
93f7870b2063d4ddb1f35dc4de4b213d83e0f54f59511b3050e880763f2374b3816ac0c879de76fe8a0b61d62c1753c5dda7326961164a8fcbfc8a9232309569 fix-fdinfo-file-handling.patch
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
a48336bbfead6ad0c84d2fce0c40a3f5530aebdff356a6835cceaf59a50a6f860d2f8027703a92927955fbb18857ba78788e010d017bf67730f069b36e96fe87 0001-fix-video-argb-setting.patch"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
|
@ -1,80 +0,0 @@
|
|||
From 562eac4226c2cf8718b8d87fc947545ccbb6dd20 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Mon, 4 Jun 2012 11:00:45 -0700
|
||||
Subject: [PATCH] vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
|
||||
|
||||
Cyrill Gorcunov reports that I broke the fdinfo files with commit
|
||||
30a08bf2d31d ("proc: move fd symlink i_mode calculations into
|
||||
tid_fd_revalidate()"), and he's quite right.
|
||||
|
||||
The tid_fd_revalidate() function is not just used for the <tid>/fd
|
||||
symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
|
||||
permission model for those are different.
|
||||
|
||||
So do the dynamic symlink permission handling just for symlinks, making
|
||||
the fdinfo files once more appear as the proper regular files they are.
|
||||
|
||||
Of course, Al Viro argued (probably correctly) that we shouldn't do the
|
||||
symlink permission games at all, and make the symlinks always just be
|
||||
the normal 'lrwxrwxrwx'. That would have avoided this issue too, but
|
||||
since somebody noticed that the permissions had changed (which was the
|
||||
reason for that original commit 30a08bf2d31d in the first place), people
|
||||
do apparently use this feature.
|
||||
|
||||
[ Basically, you can use the symlink permission data as a cheap "fdinfo"
|
||||
replacement, since you see whether the file is open for reading and/or
|
||||
writing by just looking at st_mode of the symlink. So the feature
|
||||
does make sense, even if the pain it has caused means we probably
|
||||
shouldn't have done it to begin with. ]
|
||||
|
||||
Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 2f198dad..c8cb15dc 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1838,7 +1838,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1854,12 +1854,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1894,6 +1896,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pkgname=linux-huawei-y530
|
||||
pkgver=3.4.0
|
||||
pkgrel=9
|
||||
pkgrel=10
|
||||
pkgdesc="Kernel for Huawei MSM8x1x devices"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -39,7 +39,7 @@ source="
|
|||
07_fix_mdss_fb_refresh_rate.patch
|
||||
08_fix_touchscreen.patch
|
||||
09_fix_various_include_directives.patch
|
||||
10_vfs-fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
gcc10-extern_YYLOC_global_declaration.patch
|
||||
"
|
||||
builddir="$srcdir/$_repository-$_commit"
|
||||
|
@ -95,5 +95,5 @@ fbc61e379403990167853f4c4fbdfa22d7e9661a7eedecf2a75eec2a8008991a82d0a61be844ab4b
|
|||
1f743d3e7f4ac7401167ea35edc7d7e113bd80824c4d53631d7500f33557ff486163f8244786c16506b2e21db6ccbcd8a0f7b26fcf4937efee50b62c074f9a22 07_fix_mdss_fb_refresh_rate.patch
|
||||
f83e9b6549155a2f32c89dffbab3ad6fba7b8d93976dfccb1232833244ed6e064e28105a321eaa934c5bb326384730d03f3d3141227a7258a30045fa12573268 08_fix_touchscreen.patch
|
||||
c9831aa037d4cb26fa349c44a27111daf8f7a84a9527d0221ecc4f01839b195243c178838663ff7592bb1d5c3cdc9872b449254beb7b9dffa67c365c3d8e042c 09_fix_various_include_directives.patch
|
||||
b0b9bcea00ca4a79ea6d6a9e0b153559161a102b0856193c7d775318beeb1d4ffb194127bf8f94f006930dd7cd330c3185f9bd205fef39e9856ffe9019fc2a34 10_vfs-fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
pkgname=linux-samsung-ms013g
|
||||
pkgver=3.4.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Samsung Galaxy Grand 2 kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -23,7 +23,7 @@ source="
|
|||
kernel-use-the-gnu89-standard-explicitly.patch
|
||||
gcc10-extern_YYLOC_global_declaration.patch
|
||||
timeconst_fix.patch
|
||||
elogind.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
|
||||
0001-fix-video-argb-setting.patch
|
||||
fix_fb.patch
|
||||
|
@ -58,7 +58,7 @@ sha512sums="3312bba75b65e8ef46ecdc043938130ef5c5ae8a58dbc03d8b6ec23160b120c738f0
|
|||
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
|
||||
7191d532df8f6a8bf64b5b5bcaa7343c8d1b844c891a67fc6d29f421903ddd46c3e779a6f5a5833a6a8f635d1582f5224fa795b3912b8b211a90ee561ad31469 timeconst_fix.patch
|
||||
93f7870b2063d4ddb1f35dc4de4b213d83e0f54f59511b3050e880763f2374b3816ac0c879de76fe8a0b61d62c1753c5dda7326961164a8fcbfc8a9232309569 elogind.patch
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
27f890cf82027649ba742b606a87ce6a82f9685b075bb7b50bffec77221e70434ee78d118d39048350537c5ecdad208658967e492eeeb997e7f6884fa78ac696 0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
|
||||
a48336bbfead6ad0c84d2fce0c40a3f5530aebdff356a6835cceaf59a50a6f860d2f8027703a92927955fbb18857ba78788e010d017bf67730f069b36e96fe87 0001-fix-video-argb-setting.patch
|
||||
a1267c3a999aafd4d9ef9c5f75cdf05605a3dc53466681d232721f1613b06f1d54c9a80f964d3114c42800faef53457c7c80867381adea0010deda4cdbd4c2ce fix_fb.patch"
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
From 25437b2a54dd619a96e268ecaf303b089aa785e4 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Mon, 4 Jun 2012 11:00:45 -0700
|
||||
Subject: [PATCH] vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
|
||||
|
||||
commit 0640113be25d283e0ff77a9f041e1242182387f0 upstream.
|
||||
|
||||
Cyrill Gorcunov reports that I broke the fdinfo files with commit
|
||||
30a08bf2d31d ("proc: move fd symlink i_mode calculations into
|
||||
tid_fd_revalidate()"), and he's quite right.
|
||||
|
||||
The tid_fd_revalidate() function is not just used for the <tid>/fd
|
||||
symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
|
||||
permission model for those are different.
|
||||
|
||||
So do the dynamic symlink permission handling just for symlinks, making
|
||||
the fdinfo files once more appear as the proper regular files they are.
|
||||
|
||||
Of course, Al Viro argued (probably correctly) that we shouldn't do the
|
||||
symlink permission games at all, and make the symlinks always just be
|
||||
the normal 'lrwxrwxrwx'. That would have avoided this issue too, but
|
||||
since somebody noticed that the permissions had changed (which was the
|
||||
reason for that original commit 30a08bf2d31d in the first place), people
|
||||
do apparently use this feature.
|
||||
|
||||
[ Basically, you can use the symlink permission data as a cheap "fdinfo"
|
||||
replacement, since you see whether the file is open for reading and/or
|
||||
writing by just looking at st_mode of the symlink. So the feature
|
||||
does make sense, even if the pain it has caused means we probably
|
||||
shouldn't have done it to begin with. ]
|
||||
|
||||
Change-Id: I6499a97dc8993b3dd6b4df5af2724990ee91fd3b
|
||||
Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 2f198dad12c5..c8cb15dcca08 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1838,7 +1838,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1854,12 +1854,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1894,6 +1896,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
|
@ -2,7 +2,7 @@
|
|||
# Kernel config based on: arch/arm/configs/lx_smultron_defconfig
|
||||
pkgname=linux-semc-smultron
|
||||
pkgver=3.4.0
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="Sony Ericsson Xperia mini kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -23,7 +23,7 @@ source="
|
|||
gcc8-fix-put-user.patch
|
||||
kernel-use-the-gnu89-standard-explicitly.patch
|
||||
fix-perf_trace_counters.patch
|
||||
fix-proc-file-handling.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
"
|
||||
builddir="$srcdir/$_repository-$_commit"
|
||||
|
||||
|
@ -48,4 +48,4 @@ sha512sums="234e8973236e6056c60a312340ef4ccb7598adc43bd1f0c2ca0e89d03f4e16ecfdd5
|
|||
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
|
||||
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||
f85ced49ee2f2461adea68dac0a10452aa809a7d41d869092d94eb085344919a9a385dec0c48011f4601ca4f441700f7fe49075c7eca4fb2d66b01f7d413ccb7 fix-perf_trace_counters.patch
|
||||
93f7870b2063d4ddb1f35dc4de4b213d83e0f54f59511b3050e880763f2374b3816ac0c879de76fe8a0b61d62c1753c5dda7326961164a8fcbfc8a9232309569 fix-proc-file-handling.patch"
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch"
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
From 25437b2a54dd619a96e268ecaf303b089aa785e4 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Mon, 4 Jun 2012 11:00:45 -0700
|
||||
Subject: [PATCH] vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
|
||||
|
||||
commit 0640113be25d283e0ff77a9f041e1242182387f0 upstream.
|
||||
|
||||
Cyrill Gorcunov reports that I broke the fdinfo files with commit
|
||||
30a08bf2d31d ("proc: move fd symlink i_mode calculations into
|
||||
tid_fd_revalidate()"), and he's quite right.
|
||||
|
||||
The tid_fd_revalidate() function is not just used for the <tid>/fd
|
||||
symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
|
||||
permission model for those are different.
|
||||
|
||||
So do the dynamic symlink permission handling just for symlinks, making
|
||||
the fdinfo files once more appear as the proper regular files they are.
|
||||
|
||||
Of course, Al Viro argued (probably correctly) that we shouldn't do the
|
||||
symlink permission games at all, and make the symlinks always just be
|
||||
the normal 'lrwxrwxrwx'. That would have avoided this issue too, but
|
||||
since somebody noticed that the permissions had changed (which was the
|
||||
reason for that original commit 30a08bf2d31d in the first place), people
|
||||
do apparently use this feature.
|
||||
|
||||
[ Basically, you can use the symlink permission data as a cheap "fdinfo"
|
||||
replacement, since you see whether the file is open for reading and/or
|
||||
writing by just looking at st_mode of the symlink. So the feature
|
||||
does make sense, even if the pain it has caused means we probably
|
||||
shouldn't have done it to begin with. ]
|
||||
|
||||
Change-Id: I6499a97dc8993b3dd6b4df5af2724990ee91fd3b
|
||||
Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 2f198dad12c5..c8cb15dcca08 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1838,7 +1838,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1854,12 +1854,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1894,6 +1896,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
|
@ -1,51 +0,0 @@
|
|||
From ff0cdcc049c0c4b36a23eb6880a116d5f78e90e3 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad <32096130+ewentual@users.noreply.github.com>
|
||||
Date: Sat, 9 Jun 2018 12:03:07 +0200
|
||||
Subject: [PATCH] Update base.c
|
||||
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 64dd67f74cd..4484fa0a8ed 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1803,7 +1803,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1819,12 +1819,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1859,6 +1861,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
pkgname=linux-sony-eagle
|
||||
pkgver=3.4.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Sony Xperia M2 kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -34,7 +34,7 @@ source="
|
|||
01_timeconst_fix.patch
|
||||
02_reduce_lzo_compression.patch
|
||||
03_fix_add_uevent_var.patch
|
||||
06_fix_too_many_levels_of_symlinks.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
gcc-wrapper-port-to-py3.patch
|
||||
gcc10-extern_YYLOC_global_declaration.patch
|
||||
"
|
||||
|
@ -76,6 +76,6 @@ f9e75725bd2c8e8e65af0ed07601aa9cfb3404653b94cb249d2e063be2877e0738fcbcdfb8bfefea
|
|||
a2bb98fb8d988bbb659cae00fbaca360828300e9b98b90aed5ee0dd839c3f740696df4094a9021b813cbada06820d115aabed581a47cdd2c947e8d853c20b145 01_timeconst_fix.patch
|
||||
30ac7171fe2a5aa90c15e56465b35bfc84015079296df2ebbb4287a2848ac5e8cf8e0dbb00dfdf84acb6692587eefdfc338e65ef3170a1a3e5b279b317ba43f3 02_reduce_lzo_compression.patch
|
||||
72553b9283552fd003ee50e93a96c358184503e02500ca0b1790eb5e5e16c308193c04ee881dbf447424bba50afa2d1e38ad01a1d34482dcc17e73a337e07026 03_fix_add_uevent_var.patch
|
||||
18a413d0fc91aa95640b0d073fa1ab510056a87a541f9fc5a9272943bb2971492e51eedb84f2cbef56584c1f1c6dfdeb6b5984bbb8161f70409bdd5028f400d3 06_fix_too_many_levels_of_symlinks.patch
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
13e289c889a48946cd3d976932f06f749bed5c6596776f4b683aada4e3e2f50b66286d6f550b8f2e260b58867b759591bbf8b54cc07ad9d3bb761ff477f036a1 gcc-wrapper-port-to-py3.patch
|
||||
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
|
@ -1,51 +0,0 @@
|
|||
From ff0cdcc049c0c4b36a23eb6880a116d5f78e90e3 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad <32096130+ewentual@users.noreply.github.com>
|
||||
Date: Sat, 9 Jun 2018 12:03:07 +0200
|
||||
Subject: [PATCH] Update base.c
|
||||
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 64dd67f74cd..4484fa0a8ed 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1803,7 +1803,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1819,12 +1819,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1859,6 +1861,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
pkgname=linux-sony-nicki
|
||||
pkgver=3.4.0
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="Sony Xperia M kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -26,7 +26,7 @@ source="
|
|||
03_kgsl_iommu_sync_lock.patch
|
||||
04_psmouse_base.patch
|
||||
05_try_to_make_kgsl_work.patch
|
||||
06_fix_too_many_levels_of_symlinks.patch
|
||||
linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||
gcc8-fix-put-user.patch
|
||||
kernel-use-the-gnu89-standard-explicitly.patch
|
||||
|
@ -56,7 +56,7 @@ a8c955bf718f155011e980f3d0948be98e1fee5649f418299a4851780543019daf7afa406aa7b082
|
|||
448bad436377a22c93ac401b9aecb504fe8e84b9511a3dd28f3cc125f3725cc1168ef03dee9f8f1085a9fbb7910b9e75cd25a382ccce626b427c8e27f7c17ffc 03_kgsl_iommu_sync_lock.patch
|
||||
f7e31cfe422696922aec52002e56c58103183966edee3bb8e1995d33f8d37b07c32280a8ecc213874e358a6ff367418556a4542fba7e3c17e4b8e82e05c3a543 04_psmouse_base.patch
|
||||
270aa134a7040409cf2ec5502939b8aa68470c47eeb2bef8f378aa2758a8b546b79018298a81625351f1c06241d8f76bf016793474f58b888db7871a5d745801 05_try_to_make_kgsl_work.patch
|
||||
18a413d0fc91aa95640b0d073fa1ab510056a87a541f9fc5a9272943bb2971492e51eedb84f2cbef56584c1f1c6dfdeb6b5984bbb8161f70409bdd5028f400d3 06_fix_too_many_levels_of_symlinks.patch
|
||||
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100 linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
|
||||
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../.shared-patches/linux/linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
|
Loading…
Reference in a new issue