• Mitko Haralanov's avatar
    IB/hfi1: Improve J_KEY generation · 08fe16f6
    Mitko Haralanov authored
    Previously, J_KEY generation was based on the lower 16 bits
    of the user's UID. While this works, it was not good enough
    as a non-root user could collide with a root user given a
    sufficiently large UID.
    
    This patch attempt to improve the J_KEY generation by using
    the following algorithm:
    
    The 16 bit J_KEY space is partitioned into 3 separate spaces
    reserved for different user classes:
       * all users with administtor privileges (including 'root')
         will use J_KEYs in the range of 0 to 31,
       * all kernel protocols, which use KDETH packets will use
         J_KEYs in the range of 32 to 63, and
       * all other users will use J_KEYs in the range of 64 to
         65535.
    
    The above separation is aimed at preventing different user levels
    from sending packets to each other and, additionally, separate
    kernel protocols from all other types of users. The later is meant
    to prevent the potential corruption of kernel memory by any other
    type of user.
    Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
    Signed-off-by: default avatarMitko Haralanov <mitko.haralanov@intel.com>
    Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
    Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
    08fe16f6
hfi.h 62.5 KB