Skip to content
  • Philippe Gerum's avatar
    evl: y2038: sanitize timespec handling at kernel boundary · bf103a6b
    Philippe Gerum authored
    
    
    All timespec passed from/to user-space are now y2038-compliant
    (i.e. tv_sec is 64bit wide), using the __evl_timespec and
    __evl_itimerspec type definitions at kernel boundary. Conversions
    happen back and forth between these types and the timespec64 and
    itimerspec64 types used internally.
    
    Invariant: __evl_timespec and __evl_itimerspec are compatible bitwise
    with __kernel_timespec and __kernel_itimerspec respectively. libevl
    does assume so.
    
    Also:
    
    - The sanitization fixes the ABI so that timespec and itimerspec
      structs are always passed by address, ensuring -EFAULT on invalid
      pointer received from the user, instead of putting the latter at
      risk of SIGSEGV by forcing it to copy/dereference these arguments.
    
    - what EVL_CLKIOC_ADJ_TIME should do was never specified in the
      context of an EVL clock, and no defined use case ever
      existed. However, this service caused a y2038 problem due to the
      legacy timex struct argument. This service was removed from the ABI.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    bf103a6b