The RSEQ rework changed that to RSEQ_CPU_UNINITILIZED, which is obviously incompatible. Revert back to the original behavior.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -236,11 +236,6 @@ static int __init rseq_debugfs_init(void) · 235 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | __initcall(rseq_debugfs_init); |
| 238 | 238 | |
| 239 | −static bool rseq_set_ids(struct task_struct *t, struct rseq_ids *ids, u32 node_id) | |
| 240 | −{ | |
| 241 | − return rseq_set_ids_get_csaddr(t, ids, node_id, NULL); | |
| 242 | −} | |
| 243 | − | |
| 244 | 239 | static bool rseq_handle_cs(struct task_struct *t, struct pt_regs *regs) |
| 245 | 240 | { |
| 246 | 241 | struct rseq __user *urseq = t->rseq.usrptr; |
| @@ -384,19 +379,22 @@ void rseq_syscall(struct pt_regs *regs) · 137 unmodified lines | ||
| 384 | 379 | |
| 385 | 380 | static bool rseq_reset_ids(void) |
| 386 | 381 | { |
| 387 | − struct rseq_ids ids = { | |
| 388 | − .cpu_id = RSEQ_CPU_ID_UNINITIALIZED, | |
| 389 | − .mm_cid = 0, | |
| 390 | − }; | |
| 382 | + struct rseq __user *rseq = current->rseq.usrptr; | |
| 391 | 383 | |
| 392 | 384 | /* |
| 393 | 385 | * If this fails, terminate it because this leaves the kernel in |
| 394 | 386 | * stupid state as exit to user space will try to fixup the ids |
| 395 | 387 | * again. |
| 396 | 388 | */ |
| 397 | − if (rseq_set_ids(current, &ids, 0)) | |
| 398 | − return true; | |
| 389 | + scoped_user_rw_access(rseq, efault) { | |
| 390 | + unsafe_put_user(0, &rseq->cpu_id_start, efault); | |
| 391 | + unsafe_put_user(RSEQ_CPU_ID_UNINITIALIZED, &rseq->cpu_id, efault); | |
| 392 | + unsafe_put_user(0, &rseq->node_id, efault); | |
| 393 | + unsafe_put_user(0, &rseq->mm_cid, efault); | |
| 394 | + } | |
| 395 | + return true; | |
| 399 | 396 | |
| 397 | +efault: | |
| 400 | 398 | force_sig(SIGSEGV); |
| 401 | 399 | return false; |
| 402 | 400 | } |