| .. | .. |
|---|
| 10 | 10 | #include <linux/fs.h> |
|---|
| 11 | 11 | #include <linux/mm.h> |
|---|
| 12 | 12 | #include <linux/audit.h> |
|---|
| 13 | +#include <linux/numa.h> |
|---|
| 13 | 14 | #include <linux/scs.h> |
|---|
| 14 | 15 | |
|---|
| 15 | | -#include <asm/pgtable.h> |
|---|
| 16 | 16 | #include <linux/uaccess.h> |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | static struct signal_struct init_signals = { |
|---|
| .. | .. |
|---|
| 26 | 26 | .multiprocess = HLIST_HEAD_INIT, |
|---|
| 27 | 27 | .rlim = INIT_RLIMITS, |
|---|
| 28 | 28 | .cred_guard_mutex = __MUTEX_INITIALIZER(init_signals.cred_guard_mutex), |
|---|
| 29 | + .exec_update_lock = __RWSEM_INITIALIZER(init_signals.exec_update_lock), |
|---|
| 29 | 30 | #ifdef CONFIG_POSIX_TIMERS |
|---|
| 30 | 31 | .posix_timers = LIST_HEAD_INIT(init_signals.posix_timers), |
|---|
| 31 | 32 | .cputimer = { |
|---|
| 32 | 33 | .cputime_atomic = INIT_CPUTIME_ATOMIC, |
|---|
| 33 | | - .running = false, |
|---|
| 34 | | - .checking_timer = false, |
|---|
| 35 | 34 | }, |
|---|
| 36 | 35 | #endif |
|---|
| 37 | 36 | INIT_CPU_TIMERS(init_signals) |
|---|
| .. | .. |
|---|
| 45 | 44 | }; |
|---|
| 46 | 45 | |
|---|
| 47 | 46 | static struct sighand_struct init_sighand = { |
|---|
| 48 | | - .count = ATOMIC_INIT(1), |
|---|
| 47 | + .count = REFCOUNT_INIT(1), |
|---|
| 49 | 48 | .action = { { { .sa_handler = SIG_DFL, } }, }, |
|---|
| 50 | 49 | .siglock = __SPIN_LOCK_UNLOCKED(init_sighand.siglock), |
|---|
| 51 | 50 | .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(init_sighand.signalfd_wqh), |
|---|
| 52 | 51 | }; |
|---|
| 53 | 52 | |
|---|
| 54 | | -#if defined(CONFIG_POSIX_TIMERS) && defined(CONFIG_PREEMPT_RT_BASE) |
|---|
| 55 | | -# define INIT_TIMER_LIST .posix_timer_list = NULL, |
|---|
| 56 | | -#else |
|---|
| 57 | | -# define INIT_TIMER_LIST |
|---|
| 53 | +#ifdef CONFIG_SHADOW_CALL_STACK |
|---|
| 54 | +unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)] |
|---|
| 55 | + __init_task_data = { |
|---|
| 56 | + [(SCS_SIZE / sizeof(long)) - 1] = SCS_END_MAGIC |
|---|
| 57 | +}; |
|---|
| 58 | 58 | #endif |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | /* |
|---|
| .. | .. |
|---|
| 65 | 65 | #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK |
|---|
| 66 | 66 | __init_task_data |
|---|
| 67 | 67 | #endif |
|---|
| 68 | + __aligned(L1_CACHE_BYTES) |
|---|
| 68 | 69 | = { |
|---|
| 69 | 70 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
|---|
| 70 | 71 | .thread_info = INIT_THREAD_INFO(init_task), |
|---|
| 71 | | - .stack_refcount = ATOMIC_INIT(1), |
|---|
| 72 | + .stack_refcount = REFCOUNT_INIT(1), |
|---|
| 72 | 73 | #endif |
|---|
| 73 | 74 | .state = 0, |
|---|
| 74 | 75 | .stack = init_stack, |
|---|
| 75 | | - .usage = ATOMIC_INIT(2), |
|---|
| 76 | + .usage = REFCOUNT_INIT(2), |
|---|
| 76 | 77 | .flags = PF_KTHREAD, |
|---|
| 77 | 78 | .prio = MAX_PRIO - 20, |
|---|
| 78 | 79 | .static_prio = MAX_PRIO - 20, |
|---|
| .. | .. |
|---|
| 81 | 82 | .cpus_ptr = &init_task.cpus_mask, |
|---|
| 82 | 83 | .cpus_mask = CPU_MASK_ALL, |
|---|
| 83 | 84 | .nr_cpus_allowed= NR_CPUS, |
|---|
| 84 | | - .cpus_requested = CPU_MASK_ALL, |
|---|
| 85 | | -#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) && \ |
|---|
| 86 | | - defined(CONFIG_SCHED_DEBUG) |
|---|
| 87 | | - .pinned_on_cpu = -1, |
|---|
| 88 | | -#endif |
|---|
| 89 | 85 | .mm = NULL, |
|---|
| 90 | 86 | .active_mm = &init_mm, |
|---|
| 91 | 87 | .restart_block = { |
|---|
| .. | .. |
|---|
| 118 | 114 | .thread = INIT_THREAD, |
|---|
| 119 | 115 | .fs = &init_fs, |
|---|
| 120 | 116 | .files = &init_files, |
|---|
| 117 | +#ifdef CONFIG_IO_URING |
|---|
| 118 | + .io_uring = NULL, |
|---|
| 119 | +#endif |
|---|
| 121 | 120 | .signal = &init_signals, |
|---|
| 122 | 121 | .sighand = &init_sighand, |
|---|
| 123 | 122 | .nsproxy = &init_nsproxy, |
|---|
| .. | .. |
|---|
| 131 | 130 | INIT_CPU_TIMERS(init_task) |
|---|
| 132 | 131 | .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(init_task.pi_lock), |
|---|
| 133 | 132 | .timer_slack_ns = 50000, /* 50 usec default slack */ |
|---|
| 134 | | - INIT_TIMER_LIST |
|---|
| 135 | 133 | .thread_pid = &init_struct_pid, |
|---|
| 136 | 134 | .thread_group = LIST_HEAD_INIT(init_task.thread_group), |
|---|
| 137 | 135 | .thread_node = LIST_HEAD_INIT(init_signals.thread_head), |
|---|
| 138 | | -#ifdef CONFIG_AUDITSYSCALL |
|---|
| 136 | +#ifdef CONFIG_AUDIT |
|---|
| 139 | 137 | .loginuid = INVALID_UID, |
|---|
| 140 | 138 | .sessionid = AUDIT_SID_UNSET, |
|---|
| 141 | 139 | #endif |
|---|
| .. | .. |
|---|
| 154 | 152 | .rcu_tasks_holdout_list = LIST_HEAD_INIT(init_task.rcu_tasks_holdout_list), |
|---|
| 155 | 153 | .rcu_tasks_idle_cpu = -1, |
|---|
| 156 | 154 | #endif |
|---|
| 155 | +#ifdef CONFIG_TASKS_TRACE_RCU |
|---|
| 156 | + .trc_reader_nesting = 0, |
|---|
| 157 | + .trc_reader_special.s = 0, |
|---|
| 158 | + .trc_holdout_list = LIST_HEAD_INIT(init_task.trc_holdout_list), |
|---|
| 159 | +#endif |
|---|
| 157 | 160 | #ifdef CONFIG_CPUSETS |
|---|
| 158 | | - .mems_allowed_seq = SEQCNT_ZERO(init_task.mems_allowed_seq), |
|---|
| 161 | + .mems_allowed_seq = SEQCNT_SPINLOCK_ZERO(init_task.mems_allowed_seq, |
|---|
| 162 | + &init_task.alloc_lock), |
|---|
| 159 | 163 | #endif |
|---|
| 160 | 164 | #ifdef CONFIG_RT_MUTEXES |
|---|
| 161 | 165 | .pi_waiters = RB_ROOT_CACHED, |
|---|
| .. | .. |
|---|
| 168 | 172 | .vtime.state = VTIME_SYS, |
|---|
| 169 | 173 | #endif |
|---|
| 170 | 174 | #ifdef CONFIG_NUMA_BALANCING |
|---|
| 171 | | - .numa_preferred_nid = -1, |
|---|
| 175 | + .numa_preferred_nid = NUMA_NO_NODE, |
|---|
| 172 | 176 | .numa_group = NULL, |
|---|
| 173 | 177 | .numa_faults = NULL, |
|---|
| 174 | 178 | #endif |
|---|
| 175 | | -#ifdef CONFIG_KASAN |
|---|
| 179 | +#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) |
|---|
| 176 | 180 | .kasan_depth = 1, |
|---|
| 181 | +#endif |
|---|
| 182 | +#ifdef CONFIG_KCSAN |
|---|
| 183 | + .kcsan_ctx = { |
|---|
| 184 | + .disable_count = 0, |
|---|
| 185 | + .atomic_next = 0, |
|---|
| 186 | + .atomic_nest_count = 0, |
|---|
| 187 | + .in_flat_atomic = false, |
|---|
| 188 | + .access_mask = 0, |
|---|
| 189 | + .scoped_accesses = {LIST_POISON1, NULL}, |
|---|
| 190 | + }, |
|---|
| 177 | 191 | #endif |
|---|
| 178 | 192 | #ifdef CONFIG_TRACE_IRQFLAGS |
|---|
| 179 | 193 | .softirqs_enabled = 1, |
|---|
| 180 | 194 | #endif |
|---|
| 181 | 195 | #ifdef CONFIG_LOCKDEP |
|---|
| 196 | + .lockdep_depth = 0, /* no locks held yet */ |
|---|
| 197 | + .curr_chain_key = INITIAL_CHAIN_KEY, |
|---|
| 182 | 198 | .lockdep_recursion = 0, |
|---|
| 183 | 199 | #endif |
|---|
| 184 | 200 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
|---|
| 185 | 201 | .ret_stack = NULL, |
|---|
| 186 | 202 | .tracing_graph_pause = ATOMIC_INIT(0), |
|---|
| 187 | 203 | #endif |
|---|
| 188 | | -#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPT) |
|---|
| 204 | +#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPTION) |
|---|
| 189 | 205 | .trace_recursion = 0, |
|---|
| 190 | 206 | #endif |
|---|
| 191 | 207 | #ifdef CONFIG_LIVEPATCH |
|---|
| .. | .. |
|---|
| 194 | 210 | #ifdef CONFIG_SECURITY |
|---|
| 195 | 211 | .security = NULL, |
|---|
| 196 | 212 | #endif |
|---|
| 213 | +#ifdef CONFIG_SECCOMP_FILTER |
|---|
| 214 | + .seccomp = { .filter_count = ATOMIC_INIT(0) }, |
|---|
| 215 | +#endif |
|---|
| 216 | +#ifdef CONFIG_ANDROID_VENDOR_OEM_DATA |
|---|
| 217 | + .android_vendor_data1 = {0, }, |
|---|
| 218 | + .android_oem_data1 = {0, }, |
|---|
| 219 | +#endif |
|---|
| 197 | 220 | }; |
|---|
| 198 | 221 | EXPORT_SYMBOL(init_task); |
|---|
| 199 | | - |
|---|
| 200 | | -#ifdef CONFIG_SHADOW_CALL_STACK |
|---|
| 201 | | -unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)] __init_task_data |
|---|
| 202 | | - __aligned(SCS_SIZE) = { |
|---|
| 203 | | - [(SCS_SIZE / sizeof(long)) - 1] = SCS_END_MAGIC |
|---|
| 204 | | -}; |
|---|
| 205 | | -#endif |
|---|
| 206 | 222 | |
|---|
| 207 | 223 | /* |
|---|
| 208 | 224 | * Initial thread structure. Alignment of this is handled by a special |
|---|