Commit 2e17430
riscv: Add support for the tagged address ABI
When pointer masking is enabled for userspace, the kernel can accept
tagged pointers as arguments to some system calls. Allow this by
untagging the pointers in access_ok() and the uaccess routines. The
uaccess routines must peform untagging in software because U-mode and
S-mode have entirely separate pointer masking configurations. In fact,
hardware may not even implement pointer masking for S-mode.
Since the number of tag bits is variable, untagged_addr_remote() needs
to know what PMLEN to use for the remote mm. Therefore, the pointer
masking mode must be the same for all threads sharing an mm. Enforce
this with a lock flag in the mm context, as x86 does for LAM. The flag
gets reset in init_new_context() during fork(), as the new mm is no
longer multithreaded.
Reviewed-by: Charlie Jenkins <[email protected]>
Tested-by: Charlie Jenkins <[email protected]>
Signed-off-by: Samuel Holland <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>1 parent 09d6775 commit 2e17430
File tree
5 files changed
+130
-10
lines changed- Documentation/arch/riscv
- arch/riscv
- include/asm
- kernel
5 files changed
+130
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
14 | 47 | | |
15 | 48 | | |
16 | 49 | | |
| |||
130 | 163 | | |
131 | 164 | | |
132 | 165 | | |
133 | | - | |
| 166 | + | |
134 | 167 | | |
135 | 168 | | |
136 | 169 | | |
| |||
246 | 279 | | |
247 | 280 | | |
248 | 281 | | |
249 | | - | |
| 282 | + | |
250 | 283 | | |
251 | 284 | | |
252 | 285 | | |
| |||
293 | 326 | | |
294 | 327 | | |
295 | 328 | | |
296 | | - | |
| 329 | + | |
297 | 330 | | |
298 | 331 | | |
299 | 332 | | |
300 | 333 | | |
301 | 334 | | |
302 | | - | |
| 335 | + | |
303 | 336 | | |
304 | 337 | | |
305 | 338 | | |
| |||
314 | 347 | | |
315 | 348 | | |
316 | 349 | | |
317 | | - | |
| 350 | + | |
318 | 351 | | |
319 | 352 | | |
320 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
216 | 220 | | |
217 | 221 | | |
218 | 222 | | |
| |||
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
261 | 270 | | |
262 | 271 | | |
263 | | - | |
| 272 | + | |
264 | 273 | | |
| 274 | + | |
265 | 275 | | |
266 | 276 | | |
267 | 277 | | |
| |||
276 | 286 | | |
277 | 287 | | |
278 | 288 | | |
279 | | - | |
| 289 | + | |
280 | 290 | | |
281 | | - | |
| 291 | + | |
| 292 | + | |
282 | 293 | | |
283 | | - | |
| 294 | + | |
| 295 | + | |
284 | 296 | | |
285 | | - | |
| 297 | + | |
286 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
287 | 319 | | |
288 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
289 | 324 | | |
290 | 325 | | |
291 | 326 | | |
| |||
298 | 333 | | |
299 | 334 | | |
300 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
301 | 340 | | |
302 | 341 | | |
303 | 342 | | |
| |||
307 | 346 | | |
308 | 347 | | |
309 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
310 | 352 | | |
311 | 353 | | |
312 | 354 | | |
| |||
316 | 358 | | |
317 | 359 | | |
318 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
319 | 379 | | |
320 | 380 | | |
321 | 381 | | |
| |||
329 | 389 | | |
330 | 390 | | |
331 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
332 | 395 | | |
333 | 396 | | |
334 | 397 | | |
| |||
0 commit comments