Thread (4 messages) flat view 4 messages, 3 authors, 2022-01-24

Re: [RFC PATCH] rseq: Fix broken uapi field layout on 32-bit little endian

From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: 2022-01-24 11:49:54
Also in: lkml, stable

----- On Jan 24, 2022, at 2:42 AM, Linus Torvalds torvalds@linux-foundation.org wrote:
On Sun, Jan 23, 2022 at 9:32 PM Mathieu Desnoyers
[off-list ref] wrote:
quoted
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.
Please don't double down on something that was already broken once.

Just remove the broken 32-bit one entirely that the kernel doesn't
even use, and make everybody use

  __u64 ptr64;

and be done with it.
OK, should I just leave:

struct rseq {
  [...]
  union rseq_cs {
    __u64 ptr64;
  } rseq_cs;
  [...]
};

and remove all the other content from the union, so users of
rseq_abi->rseq_cs.ptr64 will continue to work as-is with either
old and new headers ? This keeps a union in place with a single
element, so I just want to confirm with you that is what you
have in mind.

It does make tons of sense to just remove the broken convenience
code and let user-space handle this based on the ptr64 field, so
it will work fine with old and new headers.

Thanks for your feedback, and travel safe!

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help