Skip to content
代码片段 群组 项目
  • Mathias Krause's avatar
    3c9f3b69
    crypto: curve25519-x86_64: solve register constraints with reserved registers · 3c9f3b69
    Mathias Krause 创作于
    
    The register constraints for the inline assembly in fsqr() and fsqr2()
    are pretty tight on what the compiler may assign to the remaining three
    register variables. The clobber list only allows the following to be
    used: RDI, RSI, RBP and R12. With RAP reserving R12 and a kernel having
    CONFIG_FRAME_POINTER=y, claiming RBP, there are only two registers left
    so the compiler rightfully complains about impossible constraints.
    
    Provide alternatives that'll allow a memory reference for 'out' to solve
    the allocation constraint dilemma for this configuration.
    
    Also make 'out' an input-only operand as it is only used as such. This
    not only allows gcc to optimize its usage further, but also works around
    older gcc versions, apparently failing to handle multiple alternatives
    correctly, as in failing to initialize the 'out' operand with its input
    value.
    
    Signed-off-by: default avatarMathias Krause <minipli@grsecurity.net>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    3c9f3b69
    历史
    crypto: curve25519-x86_64: solve register constraints with reserved registers
    Mathias Krause 创作于
    
    The register constraints for the inline assembly in fsqr() and fsqr2()
    are pretty tight on what the compiler may assign to the remaining three
    register variables. The clobber list only allows the following to be
    used: RDI, RSI, RBP and R12. With RAP reserving R12 and a kernel having
    CONFIG_FRAME_POINTER=y, claiming RBP, there are only two registers left
    so the compiler rightfully complains about impossible constraints.
    
    Provide alternatives that'll allow a memory reference for 'out' to solve
    the allocation constraint dilemma for this configuration.
    
    Also make 'out' an input-only operand as it is only used as such. This
    not only allows gcc to optimize its usage further, but also works around
    older gcc versions, apparently failing to handle multiple alternatives
    correctly, as in failing to initialize the 'out' operand with its input
    value.
    
    Signed-off-by: default avatarMathias Krause <minipli@grsecurity.net>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>