[openssl/openssl] a5b3f8: Fix SM2 RISC-V64 crash from functions emitted into...

"'Mounir IDRASSI' via openssl-commits" <[email protected]> Mon, 20 Jul 2026 02:48:33 -0700
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: a5b3f8863fcefe98c0baeaf954f84a1f8017eba2
      https://github.com/openssl/openssl/commit/a5b3f8863fcefe98c0baeaf954f84a1f8017eba2
  Author: Mounir IDRASSI <[email protected]>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    M crypto/ec/asm/ecp_sm2p256-riscv64.pl

  Log Message:
  -----------
  Fix SM2 RISC-V64 crash from functions emitted into .rodata

The ecp_sm2p256-riscv64.pl generator switches to .section .rodata
to emit constant data (.Lpoly, .Lord, .Lpoly_div_2, .Lord_div_2), but
never switches back before emitting function code.

As a result, the function symbols defined by this file are assembled
into .rodata instead of executable .text. On systems enforcing NX for
.rodata, calling the RISC-V64 SM2 assembly faults immediately.

Fix this by adding .previous after the constant block, restoring the
initial .text section before function emission.

Verified with readelf: before the fix, .text is empty and the function
symbols are in .rodata; after the fix, constants remain in .rodata and
the function symbols are in executable .text.

Introduced in commit 05301b100f (PR #25918).

Reviewed-by: Paul Yang <[email protected]>
Reviewed-by: Saša Nedvědický <[email protected]>
MergeDate: Mon Jul 20 09:47:35 2026
(Merged from https://github.com/openssl/openssl/pull/31874)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/master/f106d7-a5b3f8%40github.com.