aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2017-04-28 22:46:37 +0000
committerAndreas Blaesius <skate4life@gmx.de>2017-06-07 16:50:17 +0200
commitc89ce3e20e86206d3211df1308bc232b5f9852a8 (patch)
tree3304604e1184886f6828368c08702db2b38a1977 /include/linux
parent518dc9dd2704efc2083ea005d0f618063f341bf9 (diff)
downloadkernel_samsung_espresso10-c89ce3e20e86206d3211df1308bc232b5f9852a8.zip
kernel_samsung_espresso10-c89ce3e20e86206d3211df1308bc232b5f9852a8.tar.gz
kernel_samsung_espresso10-c89ce3e20e86206d3211df1308bc232b5f9852a8.tar.bz2
kernel: Only expose su when daemon is running
It has been claimed that the PG implementation of 'su' has security vulnerabilities even when disabled. Unfortunately, the people that find these vulnerabilities often like to keep them private so they can profit from exploits while leaving users exposed to malicious hackers. In order to reduce the attack surface for vulnerabilites, it is therefore necessary to make 'su' completely inaccessible when it is not in use (except by the root and system users). Change-Id: Ia7d50ba46c3d932c2b0ca5fc8e9ec69ec9045f85 Adapted from https://review.lineageos.org/#/c/170648 Used @stargo's PF_SU/PF_FREEZER_NOSIG overlap fix Signed-off-by: D. Andrei Măceș <dmaces@nd.edu>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dcache.h7
-rw-r--r--include/linux/sched.h8
2 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1118fd9..e63ee00 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -423,6 +423,13 @@ static inline bool d_mountpoint(struct dentry *dentry)
extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
+static inline bool d_is_su(const struct dentry *dentry)
+{
+ return dentry &&
+ dentry->d_name.len == 2 &&
+ !memcmp(dentry->d_name.name, "su", 2);
+}
+
extern int sysctl_vfs_cache_pressure;
#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e012817..90e1949 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -93,6 +93,12 @@ struct sched_param {
#include <asm/processor.h>
+int su_instances(void);
+bool su_running(void);
+bool su_visible(void);
+void su_exec(void);
+void su_exit(void);
+
struct exec_domain;
struct futex_pi_state;
struct robust_list_head;
@@ -1794,6 +1800,8 @@ extern int task_free_unregister(struct notifier_block *n);
#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
+#define PF_SU 0x00001000 /* task is su */
+
/*
* Only the _current_ task can read/write to tsk->flags, but other
* tasks can access tsk->flags in readonly mode for example