From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E85F3857BAD; Tue, 24 May 2022 21:01:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E85F3857BAD From: "dave.anglin at bell dot net" To: glibc-bugs@sourceware.org Subject: [Bug libc/29165] [Regression] broken argv adjustment Date: Tue, 24 May 2022 21:01:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dave.anglin at bell dot net X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 21:01:29 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29165 --- Comment #2 from dave.anglin at bell dot net --- Thanks.=C2=A0 I think we need to keep the instructions that save and restor= e r24 and r25. They will be clobbered by call to _dl_init. Will test. On 2022-05-24 4:26 p.m., adhemerval.zanella at linaro dot org wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=3D29165 > > --- Comment #1 from Adhemerval Zanella --- > It seems hppa creates an unrelated stack frame that ld.so changes where it > saves/restore both argc and argv. Does this fix the issue: > > diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h > index 8c0ca32fc6..9ce17a7e2f 100644 > --- a/sysdeps/hppa/dl-machine.h > +++ b/sysdeps/hppa/dl-machine.h > @@ -415,10 +415,8 @@ asm ( > \ > So, obviously, we can't just pass %sp to _dl_start. That's \ > okay, argv-4 will do just fine. \ > \ > - The pleasant part of this is that if we need to skip \ > - arguments we can just decrement argc and move argv, because \ > - the stack pointer is utterly unrelated to the location of \ > - the environment and argument vectors. */ \ > + It also mean that to get the correct argc and argv if the \ > + program is ld.so it requires to read _dl_argc and _dl_argv. */\ > \ > /* This is always within range so we'll be okay. */ \ > " bl _dl_start,%rp\n" \ > @@ -430,22 +428,14 @@ asm ( > \ > /* Save the entry point in %r3. */ \ > " copy %ret0,%r3\n" \ > \ > - /* See if we were called as a command with the executable file \ > - name as an extra leading argument. */ \ > -" addil LT'_dl_skip_args,%r19\n" \ > -" ldw RT'_dl_skip_args(%r1),%r20\n" \ > -" ldw 0(%r20),%r20\n" \ > +" addil LT'_dl_argc,%r19\n" \ > +" ldw RT'_dl_argc(%r1),%r20\n" \ > +" ldw 0(%r20),%r25\n" \ > \ > -" ldw -40(%sp),%r25\n" /* argc */ \ > -" comib,=3D 0,%r20,.Lnofix\n" /* FIXME: Mispredicted branch *= /\ > -" ldw -44(%sp),%r24\n" /* argv (delay slot) */ \ > +" addil LT'_dl_argv,%r19\n" \ > +" ldw RT'_dl_argv(%r1),%r20\n" \ > +" ldw 0(%r20),%r24\n" \ > \ > -" sub %r25,%r20,%r25\n" \ > -" stw %r25,-40(%sp)\n" \ > -" sh2add %r20,%r24,%r24\n" \ > -" stw %r24,-44(%sp)\n" \ > - \ > -".Lnofix:\n" \ > /* Call _dl_init(main_map, argc, argv, envp). */ \ > " addil LT'_rtld_local,%r19\n" \ > " ldw RT'_rtld_local(%r1),%r26\n" \ > @@ -456,9 +446,6 @@ asm ( > \ > " bl _dl_init,%r2\n" \ > " ldo 4(%r23),%r23\n" /* delay slot */ \ > \ > - /* Reload argc, argv to the registers start.S expects. */ \ > -" ldw -40(%sp),%r25\n" \ > -" ldw -44(%sp),%r24\n" \ > \ > /* _dl_fini is a local function in the loader, so we construct \ > a false OPD here and pass this to the application. */ \ > > > ? > --=20 You are receiving this mail because: You are on the CC list for the bug.=