Page MenuHomeFreeBSD

ptrace asm wrapper for aarch64
AbandonedPublic

Authored by kib on Aug 28 2016, 3:10 PM.
Tags
Referenced Files
Unknown Object (File)
Tue, Apr 2, 12:34 AM
Unknown Object (File)
Jan 9 2024, 9:55 AM
Unknown Object (File)
Dec 24 2023, 12:10 AM
Unknown Object (File)
Sep 19 2023, 10:21 AM
Unknown Object (File)
Sep 10 2023, 4:24 AM
Unknown Object (File)
Aug 13 2023, 12:49 PM
Unknown Object (File)
Aug 3 2023, 2:42 AM
Unknown Object (File)
Aug 1 2023, 9:23 AM
Subscribers

Details

Reviewers
emaste
andrew
Summary

Align aarch64 with other arches, clear errno before calling ptrace syscall in the libc wrapper.

Test Plan

I was unable to test this, after I installed freshly build world/kernel from HEAD into 11.0 RC2 vm disk, I got

>> FreeBSD EFI boot block
   Loader path: /boot/loader.efi

   Initializing modules: ZFS UFS
   Probing 5 block devices.......* done
    ZFS found no pools
    UFS found 1 partition


Synchronous Exception at 0x294AD3FA2A0003EC

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib retitled this revision from to ptrace asm wrapper for aarch64.
kib updated this object.
kib edited the test plan for this revision. (Show Details)
kib added reviewers: andrew, emaste.
kib set the repository for this revision to rS FreeBSD src repository - subversion.
kib added a project: arm64.

Do you have any specific test, or would single stepping with lldb be enough?

lib/libc/aarch64/sys/ptrace.S
39โ€“42

I think this could be rewritten as:

stp x0, x1, [sp, #-48]!
stp x2, x3, [sp, #16]
stp x29, lr, [sp, #32]
add x29, sp, #32

It will then comply with the ABI.

45โ€“48

This would then be:

ldp x29, lr, [sp, #32]
ldp x2, x3, [sp, #16]
ldp x0, x1, [sp], #48
kib edited edge metadata.

Update according to the recommendations.

BTW, from my reading of the IHI 0055C_beta, it is allowed to skip frame construction for some functions:

It may require the frame pointer to address a valid frame record at all times, except that any subroutine may
elect not to create a frame record

For testing, just running truss /bin/ls with the patched libc would give good enough coverage.

And e.g. cerror does not build the frame when calling into __error.

In D7674#159465, @kib wrote:

Update according to the recommendations.

BTW, from my reading of the IHI 0055C_beta, it is allowed to skip frame construction for some functions:

It may require the frame pointer to address a valid frame record at all times, except that any subroutine may
elect not to create a frame record

The main advantage with creating it is the debugger can then perform a backtrace through the function. I added this to the kernel exception frame for this purpose.

For testing, just running truss /bin/ls with the patched libc would give good enough coverage.

Ok, I'll test it when I get a chance to update one of the netperf Caviums.

In D7674#159471, @kib wrote:

And e.g. cerror does not build the frame when calling into __error.

That should also be fixed at some stage. There are also a few places within the rtld code that also create bad frames.