diff options
| author | Corinna Vinschen <xda@vinschen.de> | 2019-04-10 20:36:23 +0200 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-05-02 17:44:25 +0200 |
| commit | 31ab448c24d5568678b78d68dac9af6a97535ab0 (patch) | |
| tree | 75dde40be2290a5830660ceb43d0f5f06d48e93c | |
| parent | a44eca0e99e666af7f49a511df785269fcb8821a (diff) | |
clean up process flags
* Move PF_WAKE_UP_IDLE to 0x00000002 to make room for PF_SUSPEND_TASK
* Drop PF_SU in favor of a bit 'task_is_su' in the task_struct bitfield
which has still lots of room without changing the struct size.
Change-Id: I2af053ebcbb3c41b7407560008da8150a73c8c05
Signed-off-by: Corinna Vinschen <xda@vinschen.de>
Signed-off-by: Moyster <oysterized@gmail.com>
| -rw-r--r-- | fs/exec.c | 2 | ||||
| -rw-r--r-- | include/linux/sched.h | 5 | ||||
| -rw-r--r-- | kernel/exit.c | 2 | ||||
| -rw-r--r-- | kernel/fork.c | 2 |
4 files changed, 8 insertions, 3 deletions
@@ -1608,7 +1608,7 @@ static int do_execve_common(const char *filename, goto out; if (is_su && capable(CAP_SYS_ADMIN)) { - current->flags |= PF_SU; + current->task_is_su = true; su_exec(); } diff --git a/include/linux/sched.h b/include/linux/sched.h index e45c95c02..9e01d7cd1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1247,6 +1247,9 @@ struct task_struct { unsigned sched_reset_on_fork:1; unsigned sched_contributes_to_load:1; + /* task is su (lineage-only, LVT-2017-000[1-3]) */ + unsigned task_is_su:1; + unsigned long atomic_flags; /* Flags needing atomic access. */ pid_t pid; @@ -1768,6 +1771,7 @@ extern int task_free_unregister(struct notifier_block *n); /* * Per process flags */ +#define PF_WAKE_UP_IDLE 0x00000002 /* try to wake up on an idle CPU */ #define PF_EXITING 0x00000004 /* getting shut down */ #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ @@ -1797,6 +1801,7 @@ extern int task_free_unregister(struct notifier_block *n); #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ + #define PF_MTKPASR 0x80000000 /* I am in MTKPASR process */ #define task_in_mtkpasr(task) unlikely(task->flags & PF_MTKPASR) diff --git a/kernel/exit.c b/kernel/exit.c index 5dc2ae8e8..fb5f11134 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -780,7 +780,7 @@ void do_exit(long code) exit_signals(tsk); /* sets PF_EXITING */ - if (tsk->flags & PF_SU) { + if (tsk->task_is_su) { su_exit(); } diff --git a/kernel/fork.c b/kernel/fork.c index b20585cca..7bef8b6e4 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -334,7 +334,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) printk("[%d:%s] fork fail at arch_dup_task_struct, err:%d \n", current->pid, current->comm, err); goto free_ti; } - tsk->flags &= ~PF_SU; + tsk->task_is_su = false; tsk->stack = ti; #ifdef CONFIG_SECCOMP |
