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: I79716c72f74d0b7af34ec3a8054896c6559a181d
This commit is contained in:
@@ -410,6 +410,13 @@ static inline bool d_mountpoint(struct dentry *dentry)
|
||||
return dentry->d_flags & DCACHE_MOUNTED;
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
@@ -1509,6 +1509,7 @@ typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
|
||||
struct dir_context {
|
||||
filldir_t actor;
|
||||
loff_t pos;
|
||||
bool romnt;
|
||||
};
|
||||
|
||||
static inline bool dir_emit(struct dir_context *ctx,
|
||||
|
||||
@@ -56,6 +56,12 @@ struct sched_param {
|
||||
#include <asm/processor.h>
|
||||
#include <linux/rtpm_prio.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;
|
||||
@@ -1774,6 +1780,8 @@ extern int task_free_unregister(struct notifier_block *n);
|
||||
|
||||
#define task_in_mtkpasr(task) unlikely(task->flags & PF_MTKPASR)
|
||||
|
||||
#define PF_SU 0x00000002 /* 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
|
||||
|
||||
@@ -64,6 +64,9 @@ static inline gid_t __kgid_val(kgid_t gid)
|
||||
#define GLOBAL_ROOT_UID KUIDT_INIT(0)
|
||||
#define GLOBAL_ROOT_GID KGIDT_INIT(0)
|
||||
|
||||
#define GLOBAL_SYSTEM_UID KUIDT_INIT(1000)
|
||||
#define GLOBAL_SYSTEM_GID KGIDT_INIT(1000)
|
||||
|
||||
#define INVALID_UID KUIDT_INIT(-1)
|
||||
#define INVALID_GID KGIDT_INIT(-1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user