:p
atchew
Login
I was playing around with building code with -Os and ran into weird crashes, that I ended up chasing down to an obviously incorrect InternalLongJump implementation, which has never been correctly passing its 2nd parameter down as the return value of SetJump. You can find the pull at https://github.com/tianocore/edk2/pull/4836, with the failing tests seemingly unrelated (at least one of these was related to CryptoPkg not being found). Andrei Warkentin (1): RISCV: Fix InternalLongJump to return correct value CryptoPkg/Library/OpensslLib/openssl | 2 +- MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108815): https://edk2.groups.io/g/devel/message/108815 Mute This Topic: https://groups.io/mt/101450444/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
InternalLongJump was not returning the 2nd parameter passed to LongJmp (Value) as the return value from SetJmp. Seen with code compiled with -Os, where an LongJmp (Buffer, -1) somehow translated to SetJmp returning 0... Cc: Yong Li <yong.li@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Tuan Phan <tphan@ventanamicro.com> Cc: Daniel Schaefer <git@danielschaefer.me> Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com> --- CryptoPkg/Library/OpensslLib/openssl | 2 +- MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CryptoPkg/Library/OpensslLib/openssl b/CryptoPkg/Library/OpensslLib/openssl index XXXXXXX..XXXXXXX 160000 --- a/CryptoPkg/Library/OpensslLib/openssl +++ b/CryptoPkg/Library/OpensslLib/openssl @@ -1 +1 @@ -Subproject commit de90e54bbe82e5be4fb9608b6f5c308bb837d355 +Subproject commit 830bf8e1e4749ad65c51b6a1d0d769ae689404ba diff --git a/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S b/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S index XXXXXXX..XXXXXXX 100644 --- a/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S @@ -XXX,XX +XXX,XX @@ // Set/Long jump for RISC-V // // Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR> +// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR> // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -XXX,XX +XXX,XX @@ InternalLongJump: REG_L s10, 11*SZREG(a0) REG_L s11, 12*SZREG(a0) REG_L sp, 13*SZREG(a0) - - add a0, s0, 0 - add a1, s1, 0 - add a2, s2, 0 - add a3, s3, 0 + mv a0, a1 ret -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108816): https://edk2.groups.io/g/devel/message/108816 Mute This Topic: https://groups.io/mt/101450445/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
I was playing around with building code with -Os and ran into weird crashes, that I ended up chasing down to an obviously incorrect InternalLongJump implementation, which has never been correctly passing its 2nd parameter down as the return value of SetJump. You can find the pull at https://github.com/tianocore/edk2/pull/4836 V2: get rid of openssl-related change due to dirty build tree. Andrei Warkentin (1): RISCV: Fix InternalLongJump to return correct value MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108820): https://edk2.groups.io/g/devel/message/108820 Mute This Topic: https://groups.io/mt/101452204/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
InternalLongJump was not returning the 2nd parameter passed to LongJmp (Value) as the return value from SetJmp. Seen with code compiled with -Os, where an LongJmp (Buffer, -1) somehow translated to SetJmp returning 0... Cc: Yong Li <yong.li@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Tuan Phan <tphan@ventanamicro.com> Cc: Daniel Schaefer <git@danielschaefer.me> Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com> --- MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S b/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S index XXXXXXX..XXXXXXX 100644 --- a/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S @@ -XXX,XX +XXX,XX @@ // Set/Long jump for RISC-V // // Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR> +// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR> // // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -XXX,XX +XXX,XX @@ InternalLongJump: REG_L s10, 11*SZREG(a0) REG_L s11, 12*SZREG(a0) REG_L sp, 13*SZREG(a0) - - add a0, s0, 0 - add a1, s1, 0 - add a2, s2, 0 - add a3, s3, 0 + mv a0, a1 ret -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108821): https://edk2.groups.io/g/devel/message/108821 Mute This Topic: https://groups.io/mt/101452205/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-