From a16697cbe56551e351fdf2dcf3be584ab32a7086 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Fri, 20 Dec 2013 08:35:28 -0500 Subject: [PATCH] Add patches to fix dummy gssd entry (rhbz 1037793) --- kernel.spec | 13 ++- ...sd-directory-when-notification-fails.patch | 50 ++++++++++ ...lntXX-dir-if-creating-the-pipe-fails.patch | 32 +++++++ ...an-info-file-for-the-dummy-gssd-pipe.patch | 96 +++++++++++++++++++ 4 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch create mode 100644 rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch create mode 100644 sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch diff --git a/kernel.spec b/kernel.spec index 84167b9ba..16bb35815 100644 --- a/kernel.spec +++ b/kernel.spec @@ -62,7 +62,7 @@ Summary: The Linux kernel # For non-released -rc kernels, this will be appended after the rcX and # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3" # -%global baserelease 302 +%global baserelease 303 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -734,6 +734,10 @@ Patch25148: alx-Reset-phy-speed-after-resume.patch Patch25152: sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch Patch25153: sunrpc-replace-gssd_running-with-more-reliable-check.patch Patch25154: nfs-check-gssd-running-before-krb5i-auth.patch +#rhbz 1037793 +Patch25166: sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch +Patch25167: rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch +Patch25168: rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch #CVE-2013-6382 rhbz 1033603 1034670 Patch25157: xfs-underflow-bug-in-xfs_attrlist_by_handle.patch @@ -1452,6 +1456,10 @@ ApplyPatch alx-Reset-phy-speed-after-resume.patch ApplyPatch sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch ApplyPatch sunrpc-replace-gssd_running-with-more-reliable-check.patch ApplyPatch nfs-check-gssd-running-before-krb5i-auth.patch +#rhbz 1037793 +ApplyPatch rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch +ApplyPatch sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch +ApplyPatch rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch #CVE-2013-6382 rhbz 1033603 1034670 ApplyPatch xfs-underflow-bug-in-xfs_attrlist_by_handle.patch @@ -2283,6 +2291,9 @@ fi # ||----w | # || || %changelog +* Fri Dec 20 2013 Josh Boyer +- Add patches to fix dummy gssd entry (rhbz 1037793) + * Wed Dec 18 2013 Josh Boyer - Fix nowatchdog-on-virt.patch to actually work in KVM guests diff --git a/rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch b/rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch new file mode 100644 index 000000000..ed03f34dd --- /dev/null +++ b/rpc_pipe-fix-cleanup-of-dummy-gssd-directory-when-notification-fails.patch @@ -0,0 +1,50 @@ +Bugzilla: 1037793 +Upstream-status: submitted for 3.14 + +Currently, it could leak dentry references in some cases. Make sure +we clean up properly. + +Signed-off-by: Jeff Layton +--- + net/sunrpc/rpc_pipe.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c +index 5d973b2..b185548 100644 +--- a/net/sunrpc/rpc_pipe.c ++++ b/net/sunrpc/rpc_pipe.c +@@ -1369,6 +1369,18 @@ out: + return pipe_dentry; + } + ++static void ++rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry) ++{ ++ struct dentry *clnt_dir = pipe_dentry->d_parent; ++ struct dentry *gssd_dir = clnt_dir->d_parent; ++ ++ __rpc_rmpipe(clnt_dir->d_inode, pipe_dentry); ++ __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1); ++ __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1); ++ dput(pipe_dentry); ++} ++ + static int + rpc_fill_super(struct super_block *sb, void *data, int silent) + { +@@ -1412,7 +1424,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) + return 0; + + err_depopulate: +- dput(gssd_dentry); ++ rpc_gssd_dummy_depopulate(gssd_dentry); + blocking_notifier_call_chain(&rpc_pipefs_notifier_list, + RPC_PIPEFS_UMOUNT, + sb); +-- +1.8.4.2 + +-- +To unsubscribe from this list: send the line "unsubscribe linux-nfs" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch b/rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch new file mode 100644 index 000000000..e4b1a255f --- /dev/null +++ b/rpc_pipe-remove-the-clntXX-dir-if-creating-the-pipe-fails.patch @@ -0,0 +1,32 @@ +Bugzilla: 1037793 +Upstream-status: submitted for 3.14 + +In the event that we create the gssd/clntXX dir, but the pipe creation +subsequently fails, then we should remove the clntXX dir before +returning. + +Signed-off-by: Jeff Layton +--- + net/sunrpc/rpc_pipe.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c +index 5cd7ad1..0b74c61 100644 +--- a/net/sunrpc/rpc_pipe.c ++++ b/net/sunrpc/rpc_pipe.c +@@ -1313,6 +1313,8 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) + } + + pipe_dentry = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data); ++ if (IS_ERR(pipe_dentry)) ++ __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); + out: + dput(clnt_dentry); + dput(gssd_dentry); +-- +1.8.4.2 + +-- +To unsubscribe from this list: send the line "unsubscribe linux-nfs" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch b/sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch new file mode 100644 index 000000000..dd3b5ba2f --- /dev/null +++ b/sunrpc-add-an-info-file-for-the-dummy-gssd-pipe.patch @@ -0,0 +1,96 @@ +Bugzilla: 1037793 +Upstream-status: submitted for 3.14 + +rpc.gssd expects to see an "info" file in each clntXX dir. Since adding +the dummy gssd pipe, users that run rpc.gssd see a lot of these messages +spamming the logs: + + rpc.gssd[508]: ERROR: can't open /var/lib/nfs/rpc_pipefs/gssd/clntXX/info: No such file or directory + rpc.gssd[508]: ERROR: failed to read service info + +Add a dummy gssd/clntXX/info file to help silence these messages. + +Signed-off-by: Jeff Layton +--- + net/sunrpc/rpc_pipe.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c +index 0b74c61..5d973b2 100644 +--- a/net/sunrpc/rpc_pipe.c ++++ b/net/sunrpc/rpc_pipe.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1275,6 +1276,44 @@ static const struct rpc_pipe_ops gssd_dummy_pipe_ops = { + .downcall = dummy_downcall, + }; + ++/* ++ * Here we present a bogus "info" file to keep rpc.gssd happy. We don't expect ++ * that it will ever use this info to handle an upcall, but rpc.gssd expects ++ * that this file will be there and have a certain format. ++ */ ++static int ++rpc_show_dummy_info(struct seq_file *m, void *v) ++{ ++ seq_printf(m, "RPC server: %s\n", utsname()->nodename); ++ seq_printf(m, "service: foo (1) version 0\n"); ++ seq_printf(m, "address: 127.0.0.1\n"); ++ seq_printf(m, "protocol: tcp\n"); ++ seq_printf(m, "port: 0\n"); ++ return 0; ++} ++ ++static int ++rpc_dummy_info_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, rpc_show_dummy_info, NULL); ++} ++ ++static const struct file_operations rpc_dummy_info_operations = { ++ .owner = THIS_MODULE, ++ .open = rpc_dummy_info_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static const struct rpc_filelist gssd_dummy_info_file[] = { ++ [0] = { ++ .name = "info", ++ .i_fop = &rpc_dummy_info_operations, ++ .mode = S_IFREG | S_IRUSR, ++ }, ++}; ++ + /** + * rpc_gssd_dummy_populate - create a dummy gssd pipe + * @root: root of the rpc_pipefs filesystem +@@ -1312,9 +1351,18 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) + goto out; + } + ++ ret = rpc_populate(clnt_dentry, gssd_dummy_info_file, 0, 1, NULL); ++ if (ret) { ++ __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); ++ pipe_dentry = ERR_PTR(ret); ++ goto out; ++ } ++ + pipe_dentry = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data); +- if (IS_ERR(pipe_dentry)) ++ if (IS_ERR(pipe_dentry)) { ++ __rpc_depopulate(clnt_dentry, gssd_dummy_info_file, 0, 1); + __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); ++ } + out: + dput(clnt_dentry); + dput(gssd_dentry); +-- +1.8.4.2