hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/init/init_task.c
....@@ -10,9 +10,9 @@
1010 #include <linux/fs.h>
1111 #include <linux/mm.h>
1212 #include <linux/audit.h>
13
+#include <linux/numa.h>
1314 #include <linux/scs.h>
1415
15
-#include <asm/pgtable.h>
1616 #include <linux/uaccess.h>
1717
1818 static struct signal_struct init_signals = {
....@@ -26,12 +26,11 @@
2626 .multiprocess = HLIST_HEAD_INIT,
2727 .rlim = INIT_RLIMITS,
2828 .cred_guard_mutex = __MUTEX_INITIALIZER(init_signals.cred_guard_mutex),
29
+ .exec_update_lock = __RWSEM_INITIALIZER(init_signals.exec_update_lock),
2930 #ifdef CONFIG_POSIX_TIMERS
3031 .posix_timers = LIST_HEAD_INIT(init_signals.posix_timers),
3132 .cputimer = {
3233 .cputime_atomic = INIT_CPUTIME_ATOMIC,
33
- .running = false,
34
- .checking_timer = false,
3534 },
3635 #endif
3736 INIT_CPU_TIMERS(init_signals)
....@@ -45,11 +44,18 @@
4544 };
4645
4746 static struct sighand_struct init_sighand = {
48
- .count = ATOMIC_INIT(1),
47
+ .count = REFCOUNT_INIT(1),
4948 .action = { { { .sa_handler = SIG_DFL, } }, },
5049 .siglock = __SPIN_LOCK_UNLOCKED(init_sighand.siglock),
5150 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(init_sighand.signalfd_wqh),
5251 };
52
+
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
+#endif
5359
5460 /*
5561 * Set up the first task table, touch at your own risk!. Base=0,
....@@ -59,22 +65,23 @@
5965 #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
6066 __init_task_data
6167 #endif
68
+ __aligned(L1_CACHE_BYTES)
6269 = {
6370 #ifdef CONFIG_THREAD_INFO_IN_TASK
6471 .thread_info = INIT_THREAD_INFO(init_task),
65
- .stack_refcount = ATOMIC_INIT(1),
72
+ .stack_refcount = REFCOUNT_INIT(1),
6673 #endif
6774 .state = 0,
6875 .stack = init_stack,
69
- .usage = ATOMIC_INIT(2),
76
+ .usage = REFCOUNT_INIT(2),
7077 .flags = PF_KTHREAD,
7178 .prio = MAX_PRIO - 20,
7279 .static_prio = MAX_PRIO - 20,
7380 .normal_prio = MAX_PRIO - 20,
7481 .policy = SCHED_NORMAL,
75
- .cpus_allowed = CPU_MASK_ALL,
82
+ .cpus_ptr = &init_task.cpus_mask,
83
+ .cpus_mask = CPU_MASK_ALL,
7684 .nr_cpus_allowed= NR_CPUS,
77
- .cpus_requested = CPU_MASK_ALL,
7885 .mm = NULL,
7986 .active_mm = &init_mm,
8087 .restart_block = {
....@@ -107,6 +114,9 @@
107114 .thread = INIT_THREAD,
108115 .fs = &init_fs,
109116 .files = &init_files,
117
+#ifdef CONFIG_IO_URING
118
+ .io_uring = NULL,
119
+#endif
110120 .signal = &init_signals,
111121 .sighand = &init_sighand,
112122 .nsproxy = &init_nsproxy,
....@@ -123,7 +133,7 @@
123133 .thread_pid = &init_struct_pid,
124134 .thread_group = LIST_HEAD_INIT(init_task.thread_group),
125135 .thread_node = LIST_HEAD_INIT(init_signals.thread_head),
126
-#ifdef CONFIG_AUDITSYSCALL
136
+#ifdef CONFIG_AUDIT
127137 .loginuid = INVALID_UID,
128138 .sessionid = AUDIT_SID_UNSET,
129139 #endif
....@@ -142,8 +152,14 @@
142152 .rcu_tasks_holdout_list = LIST_HEAD_INIT(init_task.rcu_tasks_holdout_list),
143153 .rcu_tasks_idle_cpu = -1,
144154 #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
145160 #ifdef CONFIG_CPUSETS
146
- .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),
147163 #endif
148164 #ifdef CONFIG_RT_MUTEXES
149165 .pi_waiters = RB_ROOT_CACHED,
....@@ -156,24 +172,36 @@
156172 .vtime.state = VTIME_SYS,
157173 #endif
158174 #ifdef CONFIG_NUMA_BALANCING
159
- .numa_preferred_nid = -1,
175
+ .numa_preferred_nid = NUMA_NO_NODE,
160176 .numa_group = NULL,
161177 .numa_faults = NULL,
162178 #endif
163
-#ifdef CONFIG_KASAN
179
+#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
164180 .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
+ },
165191 #endif
166192 #ifdef CONFIG_TRACE_IRQFLAGS
167193 .softirqs_enabled = 1,
168194 #endif
169195 #ifdef CONFIG_LOCKDEP
196
+ .lockdep_depth = 0, /* no locks held yet */
197
+ .curr_chain_key = INITIAL_CHAIN_KEY,
170198 .lockdep_recursion = 0,
171199 #endif
172200 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
173201 .ret_stack = NULL,
174202 .tracing_graph_pause = ATOMIC_INIT(0),
175203 #endif
176
-#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPT)
204
+#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPTION)
177205 .trace_recursion = 0,
178206 #endif
179207 #ifdef CONFIG_LIVEPATCH
....@@ -182,15 +210,15 @@
182210 #ifdef CONFIG_SECURITY
183211 .security = NULL,
184212 #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
185220 };
186221 EXPORT_SYMBOL(init_task);
187
-
188
-#ifdef CONFIG_SHADOW_CALL_STACK
189
-unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)] __init_task_data
190
- __aligned(SCS_SIZE) = {
191
- [(SCS_SIZE / sizeof(long)) - 1] = SCS_END_MAGIC
192
-};
193
-#endif
194222
195223 /*
196224 * Initial thread structure. Alignment of this is handled by a special