This source file includes following definitions.
- arch_within_stack_frames
1
2
3
4
5
6
7
8 #ifndef _ASM_X86_THREAD_INFO_H
9 #define _ASM_X86_THREAD_INFO_H
10
11 #include <linux/compiler.h>
12 #include <asm/page.h>
13 #include <asm/percpu.h>
14 #include <asm/types.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 #ifdef CONFIG_X86_32
37 # ifdef CONFIG_VM86
38 # define TOP_OF_KERNEL_STACK_PADDING 16
39 # else
40 # define TOP_OF_KERNEL_STACK_PADDING 8
41 # endif
42 #else
43 # define TOP_OF_KERNEL_STACK_PADDING 0
44 #endif
45
46
47
48
49
50
51 #ifndef __ASSEMBLY__
52 struct task_struct;
53 #include <asm/cpufeature.h>
54 #include <linux/atomic.h>
55
56 struct thread_info {
57 unsigned long flags;
58 u32 status;
59 };
60
61 #define INIT_THREAD_INFO(tsk) \
62 { \
63 .flags = 0, \
64 }
65
66 #else
67
68 #include <asm/asm-offsets.h>
69
70 #endif
71
72
73
74
75
76
77 #define TIF_SYSCALL_TRACE 0
78 #define TIF_NOTIFY_RESUME 1
79 #define TIF_SIGPENDING 2
80 #define TIF_NEED_RESCHED 3
81 #define TIF_SINGLESTEP 4
82 #define TIF_SSBD 5
83 #define TIF_SYSCALL_EMU 6
84 #define TIF_SYSCALL_AUDIT 7
85 #define TIF_SECCOMP 8
86 #define TIF_SPEC_IB 9
87 #define TIF_SPEC_FORCE_UPDATE 10
88 #define TIF_USER_RETURN_NOTIFY 11
89 #define TIF_UPROBE 12
90 #define TIF_PATCH_PENDING 13
91 #define TIF_NEED_FPU_LOAD 14
92 #define TIF_NOCPUID 15
93 #define TIF_NOTSC 16
94 #define TIF_IA32 17
95 #define TIF_NOHZ 19
96 #define TIF_MEMDIE 20
97 #define TIF_POLLING_NRFLAG 21
98 #define TIF_IO_BITMAP 22
99 #define TIF_FORCED_TF 24
100 #define TIF_BLOCKSTEP 25
101 #define TIF_LAZY_MMU_UPDATES 27
102 #define TIF_SYSCALL_TRACEPOINT 28
103 #define TIF_ADDR32 29
104 #define TIF_X32 30
105 #define TIF_FSCHECK 31
106
107 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
108 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
109 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
110 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
111 #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
112 #define _TIF_SSBD (1 << TIF_SSBD)
113 #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
114 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
115 #define _TIF_SECCOMP (1 << TIF_SECCOMP)
116 #define _TIF_SPEC_IB (1 << TIF_SPEC_IB)
117 #define _TIF_SPEC_FORCE_UPDATE (1 << TIF_SPEC_FORCE_UPDATE)
118 #define _TIF_USER_RETURN_NOTIFY (1 << TIF_USER_RETURN_NOTIFY)
119 #define _TIF_UPROBE (1 << TIF_UPROBE)
120 #define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING)
121 #define _TIF_NEED_FPU_LOAD (1 << TIF_NEED_FPU_LOAD)
122 #define _TIF_NOCPUID (1 << TIF_NOCPUID)
123 #define _TIF_NOTSC (1 << TIF_NOTSC)
124 #define _TIF_IA32 (1 << TIF_IA32)
125 #define _TIF_NOHZ (1 << TIF_NOHZ)
126 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
127 #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
128 #define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
129 #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
130 #define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES)
131 #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
132 #define _TIF_ADDR32 (1 << TIF_ADDR32)
133 #define _TIF_X32 (1 << TIF_X32)
134 #define _TIF_FSCHECK (1 << TIF_FSCHECK)
135
136
137
138
139
140 #define _TIF_WORK_SYSCALL_ENTRY \
141 (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT | \
142 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
143 _TIF_NOHZ)
144
145
146 #define _TIF_WORK_CTXSW_BASE \
147 (_TIF_IO_BITMAP|_TIF_NOCPUID|_TIF_NOTSC|_TIF_BLOCKSTEP| \
148 _TIF_SSBD | _TIF_SPEC_FORCE_UPDATE)
149
150
151
152
153 #ifdef CONFIG_SMP
154 # define _TIF_WORK_CTXSW (_TIF_WORK_CTXSW_BASE | _TIF_SPEC_IB)
155 #else
156 # define _TIF_WORK_CTXSW (_TIF_WORK_CTXSW_BASE)
157 #endif
158
159 #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
160 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
161
162 #define STACK_WARN (THREAD_SIZE/8)
163
164
165
166
167
168
169 #ifndef __ASSEMBLY__
170
171
172
173
174
175
176
177
178
179
180 static inline int arch_within_stack_frames(const void * const stack,
181 const void * const stackend,
182 const void *obj, unsigned long len)
183 {
184 #if defined(CONFIG_FRAME_POINTER)
185 const void *frame = NULL;
186 const void *oldframe;
187
188 oldframe = __builtin_frame_address(1);
189 if (oldframe)
190 frame = __builtin_frame_address(2);
191
192
193
194
195
196
197 while (stack <= frame && frame < stackend) {
198
199
200
201
202
203
204 if (obj + len <= frame)
205 return obj >= oldframe + 2 * sizeof(void *) ?
206 GOOD_FRAME : BAD_STACK;
207 oldframe = frame;
208 frame = *(const void * const *)frame;
209 }
210 return BAD_STACK;
211 #else
212 return NOT_STACK;
213 #endif
214 }
215
216 #else
217
218 #ifdef CONFIG_X86_64
219 # define cpu_current_top_of_stack (cpu_tss_rw + TSS_sp1)
220 #endif
221
222 #endif
223
224 #ifdef CONFIG_COMPAT
225 #define TS_I386_REGS_POKED 0x0004
226 #endif
227 #ifndef __ASSEMBLY__
228
229 #ifdef CONFIG_X86_32
230 #define in_ia32_syscall() true
231 #else
232 #define in_ia32_syscall() (IS_ENABLED(CONFIG_IA32_EMULATION) && \
233 current_thread_info()->status & TS_COMPAT)
234 #endif
235
236
237
238
239
240
241
242
243 #define force_iret() set_thread_flag(TIF_NOTIFY_RESUME)
244
245 extern void arch_task_cache_init(void);
246 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
247 extern void arch_release_task_struct(struct task_struct *tsk);
248 extern void arch_setup_new_exec(void);
249 #define arch_setup_new_exec arch_setup_new_exec
250 #endif
251
252 #endif