• H. Peter Anvin's avatar
    x86, mm: Redesign get_user with a __builtin_choose_expr hack · 3578baae
    H. Peter Anvin authored
    Instead of using a bitfield, use an odd little trick using typeof,
    __builtin_choose_expr, and sizeof.  __builtin_choose_expr is
    explicitly defined to not convert its type (its argument is required
    to be a constant expression) so this should be well-defined.
    
    The code is still not 100% preturbation-free versus the baseline
    before 64-bit get_user(), but the differences seem to be very small,
    mostly related to padding and to gcc deciding when to spill registers.
    
    Cc: Jamie Lokier <jamie@shareable.org>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Russell King <linux@arm.linux.org.uk>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: H. J. Lu <hjl.tools@gmail.com>
    Link: http://lkml.kernel.org/r/511A8922.6050908@zytor.comSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    3578baae
uaccess.h 16 KB