• E
    signal/arm64: Document conflicts with SI_USER and SIGFPE,SIGTRAP,SIGBUS · 526c3ddb
    Eric W. Biederman 提交于
    Setting si_code to 0 results in a userspace seeing an si_code of 0.
    This is the same si_code as SI_USER.  Posix and common sense requires
    that SI_USER not be a signal specific si_code.  As such this use of 0
    for the si_code is a pretty horribly broken ABI.
    
    Further use of si_code == 0 guaranteed that copy_siginfo_to_user saw a
    value of __SI_KILL and now sees a value of SIL_KILL with the result
    that uid and pid fields are copied and which might copying the si_addr
    field by accident but certainly not by design.  Making this a very
    flakey implementation.
    
    Utilizing FPE_FIXME, BUS_FIXME, TRAP_FIXME siginfo_layout will now return
    SIL_FAULT and the appropriate fields will be reliably copied.
    
    But folks this is a new and unique kind of bad.  This is massively
    untested code bad.  This is inventing new and unique was to get
    siginfo wrong bad.  This is don't even think about Posix or what
    siginfo means bad.  This is lots of eyeballs all missing the fact
    that the code does the wrong thing bad.  This is getting stuck
    and keep making the same mistake bad.
    
    I really hope we can find a non userspace breaking fix for this on a
    port as new as arm64.
    
    Possible ABI fixes include:
    - Send the signal without siginfo
    - Don't generate a signal
    - Possibly assign and use an appropriate si_code
    - Don't handle cases which can't happen
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Tyler Baicar <tbaicar@codeaurora.org>
    Cc: James Morse <james.morse@arm.com>
    Cc: Tony Lindgren <tony@atomide.com>
    Cc: Nicolas Pitre <nico@linaro.org>
    Cc: Olof Johansson <olof@lixom.net>
    Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: linux-arm-kernel@lists.infradead.org
    Ref: 53631b54 ("arm64: Floating point and SIMD")
    Ref: 32015c23 ("arm64: exception: handle Synchronous External Abort")
    Ref: 1d18c47c ("arm64: MMU fault handling and page table management")
    Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
    526c3ddb
siginfo.h 1.2 KB