klibc-bot for Steve McIntyre
2012-Jul-01 20:57 UTC
[klibc] [klibc:master] arm/setjmp.S: fix longjmp
Commit-ID: d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940 Author: Steve McIntyre <steve at einval.com> AuthorDate: Fri, 29 Jun 2012 18:13:34 +0100 Committer: maximilian attems <max at stro.at> CommitDate: Sun, 1 Jul 2012 22:51:00 +0200 [klibc] arm/setjmp.S: fix longjmp There's a real bug in the ARM assembly version of longjmp in usr/klibc/arch/arm/setjmp.S: it will always pass back its first argument as a return value, even if it's 0 (see the man page for more details). Oddly, the Thumb implementation in the same file *is* correct! Signed-off-by: Steve McIntyre <steve at einval.com> Signed-off-by: maximilian attems <max at stro.at> --- usr/klibc/arch/arm/setjmp.S | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/usr/klibc/arch/arm/setjmp.S b/usr/klibc/arch/arm/setjmp.S index 6018bda..d351e0e 100644 --- a/usr/klibc/arch/arm/setjmp.S +++ b/usr/klibc/arch/arm/setjmp.S @@ -41,7 +41,9 @@ setjmp: longjmp: ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} mov r0, r1 - BX(lr) + bne 1f + mov r0, #1 +1: BX(lr) .size longjmp,.-longjmp #else /* __thumb__ */
On 07/01/2012 01:57 PM, klibc-bot for Steve McIntyre wrote:> Commit-ID: d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940 > Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d7d16afbdae9bdea83aeb26ac572e6fc4d7d4940 > Author: Steve McIntyre <steve at einval.com> > AuthorDate: Fri, 29 Jun 2012 18:13:34 +0100 > Committer: maximilian attems <max at stro.at> > CommitDate: Sun, 1 Jul 2012 22:51:00 +0200 > > [klibc] arm/setjmp.S: fix longjmp > > There's a real bug in the ARM assembly version of longjmp in > usr/klibc/arch/arm/setjmp.S: it will always pass back its first > argument as a return value, even if it's 0 (see the man page for > more details). Oddly, the Thumb implementation in the same file > *is* correct! >klibc explicitly considers longjmp(..., 0) to be user error; see the README file. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
H. Peter Anvin dixit:> klibc explicitly considers longjmp(..., 0) to be user errorThis IMO is a possibly dangerous deviation from guaranteed? behaviour, and hard to track down. Also, checking this in longjmp asm probably is easier than to offload this to all users. bye, //mirabilos ? http://pubs.opengroup.org/onlinepubs/9699919799/functions/longjmp.html -- <Natureshadow> Dann mach ich git annex copy --to shore und fertig ist das <Natureshadow> das ist ja viel cooler als ownCloud ... <mirabilos> sag ich doch <Natureshadow> ja wieso stimmt das denn immer was du sagst ...