[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190523181709.625861225@linuxfoundation.org>
Date: Thu, 23 May 2019 21:05:58 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, "chengjian (D)" <cj.chengjian@...wei.com>,
Paul Moore <paul@...l-moore.com>,
John Johansen <john.johansen@...onical.com>,
James Morris <james.morris@...rosoft.com>,
Casey Schaufler <casey@...aufler-ca.com>
Subject: [PATCH 5.1 036/122] proc: prevent changes to overridden credentials
From: Paul Moore <paul@...l-moore.com>
commit 35a196bef449b5824033865b963ed9a43fb8c730 upstream.
Prevent userspace from changing the the /proc/PID/attr values if the
task's credentials are currently overriden. This not only makes sense
conceptually, it also prevents some really bizarre error cases caused
when trying to commit credentials to a task with overridden
credentials.
Cc: <stable@...r.kernel.org>
Reported-by: "chengjian (D)" <cj.chengjian@...wei.com>
Signed-off-by: Paul Moore <paul@...l-moore.com>
Acked-by: John Johansen <john.johansen@...onical.com>
Acked-by: James Morris <james.morris@...rosoft.com>
Acked-by: Casey Schaufler <casey@...aufler-ca.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/proc/base.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2540,6 +2540,11 @@ static ssize_t proc_pid_attr_write(struc
rcu_read_unlock();
return -EACCES;
}
+ /* Prevent changes to overridden credentials. */
+ if (current_cred() != current_real_cred()) {
+ rcu_read_unlock();
+ return -EBUSY;
+ }
rcu_read_unlock();
if (count > PAGE_SIZE)
Powered by blists - more mailing lists