----- On Apr 27, 2020, at 1:26 PM, Mathieu Desnoyers mathieu.desnoyers@xxxxxxxxxxxx wrote: [...] >>> We don't mind that user-space uses that pointer, but we never want the kernel >>> to touch that pointer rather than the 32/64-bit-aware fields. One possibility >>> would be to do: >>> >>> union >>> { >>> uint64_t ptr64; >>> #ifdef __LP64__ >>> uint64_t ptr; >>> #else >>> struct >>> { >>> #if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined >>> (__BIG_ENDIAN) >>> uint32_t padding; /* Initialized to zero. */ >>> uint32_t ptr32; >>> #else /* LITTLE */ >>> uint32_t ptr32; >>> uint32_t padding; /* Initialized to zero. */ >>> #endif /* ENDIAN */ >>> } ptr; >>> #endif >>> >>> #ifndef __KERNEL__ >>> const struct rseq_cs *uptr; >>> #endif >>> } rseq_cs; >>> >>> in the union, so only user-space can see that field. Thoughts ? >> >> I think this depends on where the x32 question lands. > > x32 should not be an issue as explained above, so I'm very open to > add this "uptr" for user-space only. Actually, the snippet above is broken on 32-bit. It needs to be: union { uint64_t ptr64; #ifdef __LP64__ uint64_t ptr; # ifndef __KERNEL__ const struct rseq_cs *uptr; # endif #else struct { #if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined (__BIG_ENDIAN) uint32_t padding; /* Initialized to zero. */ uint32_t ptr32; #else /* LITTLE */ uint32_t ptr32; uint32_t padding; /* Initialized to zero. */ #endif /* ENDIAN */ } ptr; # ifndef __KERNEL__ struct { # if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined (__BIG_ENDIAN) uint32_t padding; /* Initialized to zero. */ const struct rseq_cs *uptr32; # else /* LITTLE */ const struct rseq_cs *uptr32; uint32_t padding; /* Initialized to zero. */ # endif /* ENDIAN */ } uptr; # endif #endif } rseq_cs; I'll leave this out of the patchset for now as we'd need more feedback on its usefulness. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com