Page MenuHomeFreeBSD

sys/arm64: fix COMPAT_FREEBSD32 __syscall()
ClosedPublic

Authored by fuz on Tue, Oct 21, 10:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 23, 10:52 AM
Unknown Object (File)
Thu, Oct 23, 7:07 AM
Unknown Object (File)
Thu, Oct 23, 7:07 AM
Unknown Object (File)
Thu, Oct 23, 7:07 AM
Unknown Object (File)
Wed, Oct 22, 10:54 PM
Unknown Object (File)
Wed, Oct 22, 10:47 PM
Unknown Object (File)
Wed, Oct 22, 5:11 PM
Unknown Object (File)
Wed, Oct 22, 3:55 PM

Details

Summary

It seems like _QUAD_LOWWORD was incorrectly expanded into 1,
which is correct for big endian but not little endian. This
means we always grab the padding word for the syscall number,
which is usually 0, causing SIGSYS to be delivered to the caller.
Reintroduce _QUAD_LOWWORD to fix the syscall.

PR: 290411
MFC after: 1 week

Test Plan

PR 290411 reproducer no longer bugs out after applying the patch.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fuz requested review of this revision.Tue, Oct 21, 10:18 PM

Fixes: 8c9c3144ccfa ("Impleent COMPAT_FREEBSD32 for arm64. This is based on early work by andrew@.")

(typo intended)

sys/arm64/arm64/elf32_machdep.c
213

Is there a reason not to just use 0? We don't support big-endian and never will.

markmi_dsl-only.net added inline comments.
sys/arm64/arm64/elf32_machdep.c
213

Possibly:

# grep -r "code.*ap.*_QUAD_LOWWORD" /usr/src/sys/
/usr/src/sys/arm/arm/syscall.c:		sa->code = ap[_QUAD_LOWWORD];

unless both were to be changed to 0.

sys/arm64/arm64/elf32_machdep.c
213

I have done it this way to match sys/sys/arm/arm/syscall.c, as @markmi_dsl-only.net mentioned. I would prefer to have the same code in both paths.

That said, aarch64eb is not off the cards. Maybe I'll find time for it in the future.

Looking at the history: armeb support ended with 11.4 and was removed after that.

This revision is now accepted and ready to land.Wed, Oct 22, 7:25 AM

Yeah, I agree with keeping consistency w/ existing use in arm/syscall.c.

This revision was automatically updated to reflect the committed changes.