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,16 +44,17 @@
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 };
5352
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
+};
5858 #endif
5959
6060 /*
....@@ -65,14 +65,15 @@
6565 #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
6666 __init_task_data
6767 #endif
68
+ __aligned(L1_CACHE_BYTES)
6869 = {
6970 #ifdef CONFIG_THREAD_INFO_IN_TASK
7071 .thread_info = INIT_THREAD_INFO(init_task),
71
- .stack_refcount = ATOMIC_INIT(1),
72
+ .stack_refcount = REFCOUNT_INIT(1),
7273 #endif
7374 .state = 0,
7475 .stack = init_stack,
75
- .usage = ATOMIC_INIT(2),
76
+ .usage = REFCOUNT_INIT(2),
7677 .flags = PF_KTHREAD,
7778 .prio = MAX_PRIO - 20,
7879 .static_prio = MAX_PRIO - 20,
....@@ -81,11 +82,6 @@
8182 .cpus_ptr = &init_task.cpus_mask,
8283 .cpus_mask = CPU_MASK_ALL,
8384 .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
8985 .mm = NULL,
9086 .active_mm = &init_mm,
9187 .restart_block = {
....@@ -118,6 +114,9 @@
118114 .thread = INIT_THREAD,
119115 .fs = &init_fs,
120116 .files = &init_files,
117
+#ifdef CONFIG_IO_URING
118
+ .io_uring = NULL,
119
+#endif
121120 .signal = &init_signals,
122121 .sighand = &init_sighand,
123122 .nsproxy = &init_nsproxy,
....@@ -131,11 +130,10 @@
131130 INIT_CPU_TIMERS(init_task)
132131 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(init_task.pi_lock),
133132 .timer_slack_ns = 50000, /* 50 usec default slack */
134
- INIT_TIMER_LIST
135133 .thread_pid = &init_struct_pid,
136134 .thread_group = LIST_HEAD_INIT(init_task.thread_group),
137135 .thread_node = LIST_HEAD_INIT(init_signals.thread_head),
138
-#ifdef CONFIG_AUDITSYSCALL
136
+#ifdef CONFIG_AUDIT
139137 .loginuid = INVALID_UID,
140138 .sessionid = AUDIT_SID_UNSET,
141139 #endif
....@@ -154,8 +152,14 @@
154152 .rcu_tasks_holdout_list = LIST_HEAD_INIT(init_task.rcu_tasks_holdout_list),
155153 .rcu_tasks_idle_cpu = -1,
156154 #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
157160 #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),
159163 #endif
160164 #ifdef CONFIG_RT_MUTEXES
161165 .pi_waiters = RB_ROOT_CACHED,
....@@ -168,24 +172,36 @@
168172 .vtime.state = VTIME_SYS,
169173 #endif
170174 #ifdef CONFIG_NUMA_BALANCING
171
- .numa_preferred_nid = -1,
175
+ .numa_preferred_nid = NUMA_NO_NODE,
172176 .numa_group = NULL,
173177 .numa_faults = NULL,
174178 #endif
175
-#ifdef CONFIG_KASAN
179
+#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
176180 .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
+ },
177191 #endif
178192 #ifdef CONFIG_TRACE_IRQFLAGS
179193 .softirqs_enabled = 1,
180194 #endif
181195 #ifdef CONFIG_LOCKDEP
196
+ .lockdep_depth = 0, /* no locks held yet */
197
+ .curr_chain_key = INITIAL_CHAIN_KEY,
182198 .lockdep_recursion = 0,
183199 #endif
184200 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
185201 .ret_stack = NULL,
186202 .tracing_graph_pause = ATOMIC_INIT(0),
187203 #endif
188
-#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPT)
204
+#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPTION)
189205 .trace_recursion = 0,
190206 #endif
191207 #ifdef CONFIG_LIVEPATCH
....@@ -194,15 +210,15 @@
194210 #ifdef CONFIG_SECURITY
195211 .security = NULL,
196212 #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
197220 };
198221 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
206222
207223 /*
208224 * Initial thread structure. Alignment of this is handled by a special