The rseq rseq_cs.ptr.{ptr32,padding} uapi endianness handling is entirely wrong on 32-bit little endian: a preprocessor logic mistake wrongly uses the big endian field layout on 32-bit little endian architectures. Fortunately, those ptr32 accessors were never used within the kernel, and only meant as a convenience for user-space. Remove those and replace the whole rseq_cs union by a __u64 type, as this is the only thing really needed to express the ABI. Document how 32-bit architectures are meant to interact with this field.
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -128,10 +128,10 @@ static int rseq_get_rseq_cs(struct task_struct *t, struct rseq_cs *rseq_cs) · 127 unmodified lines | |||
| 128 | int ret; | 128 | int ret; |
| 129 | 129 | ||
| 130 | #ifdef CONFIG_64BIT | 130 | #ifdef CONFIG_64BIT |
| 131 | if (get_user(ptr, &t->rseq->rseq_cs.ptr64)) | 131 | if (get_user(ptr, &t->rseq->rseq_cs)) |
| 132 | return -EFAULT; | 132 | return -EFAULT; |
| 133 | #else | 133 | #else |
| 134 | if (copy_from_user(&ptr, &t->rseq->rseq_cs.ptr64, sizeof(ptr))) | 134 | if (copy_from_user(&ptr, &t->rseq->rseq_cs, sizeof(ptr))) |
| 135 | return -EFAULT; | 135 | return -EFAULT; |
| 136 | #endif | 136 | #endif |
| 137 | if (!ptr) { | 137 | if (!ptr) { |
| @@ -217,9 +217,9 @@ static int clear_rseq_cs(struct task_struct *t) · 79 unmodified lines | |||
| 217 | * Set rseq_cs to NULL. | 217 | * Set rseq_cs to NULL. |
| 218 | */ | 218 | */ |
| 219 | #ifdef CONFIG_64BIT | 219 | #ifdef CONFIG_64BIT |
| 220 | return put_user(0UL, &t->rseq->rseq_cs.ptr64); | 220 | return put_user(0UL, &t->rseq->rseq_cs); |
| 221 | #else | 221 | #else |
| 222 | if (clear_user(&t->rseq->rseq_cs.ptr64, sizeof(t->rseq->rseq_cs.ptr64))) | 222 | if (clear_user(&t->rseq->rseq_cs, sizeof(t->rseq->rseq_cs))) |
| 223 | return -EFAULT; | 223 | return -EFAULT; |
| 224 | return 0; | 224 | return 0; |
| 225 | #endif | 225 | #endif |