• Mathieu Desnoyers's avatar
    rseq: uapi: Declare rseq_cs field as union, update includes · ec9c82e0
    Mathieu Desnoyers authored
    Declaring the rseq_cs field as a union between __u64 and two __u32
    allows both 32-bit and 64-bit kernels to read the full __u64, and
    therefore validate that a 32-bit user-space cleared the upper 32
    bits, thus ensuring a consistent behavior between native 32-bit
    kernels and 32-bit compat tasks on 64-bit kernels.
    
    Check that the rseq_cs value read is < TASK_SIZE.
    
    The asm/byteorder.h header needs to be included by rseq.h, now
    that it is not using linux/types_32_64.h anymore.
    
    Considering that only __32 and __u64 types are declared in linux/rseq.h,
    the linux/types.h header should always be included for both kernel and
    user-space code: including stdint.h is just for u64 and u32, which are
    not used in this header at all.
    
    Use copy_from_user()/clear_user() to interact with a 64-bit field,
    because arm32 does not implement 64-bit __get_user, and ppc32 does not
    64-bit get_user. Considering that the rseq_cs pointer does not need to
    be loaded/stored with si...
    ec9c82e0
rseq.c 9.97 KB