Page MenuHomeFreeBSD

arm64: Correctly align the SVE signal context
ClosedPublic

Authored by andrew on Mon, Dec 29, 3:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 8, 3:07 PM
Unknown Object (File)
Thu, Jan 8, 9:57 AM
Unknown Object (File)
Mon, Jan 5, 11:19 PM
Unknown Object (File)
Sat, Jan 3, 8:35 PM
Unknown Object (File)
Thu, Jan 1, 9:34 PM
Unknown Object (File)
Thu, Jan 1, 10:11 AM
Unknown Object (File)
Thu, Jan 1, 8:47 AM
Unknown Object (File)
Wed, Dec 31, 9:15 AM
Subscribers

Details

Summary

The SVE signal context needs to be correctly aligned. Fix this by
creating a new macro to calculate the needed size to provide this
alignment, and use it when setting and checking the saved SVE signal
context.

Reported by: cperciva
Sponsored by: Arm Ltd

Diff Detail

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

Event Timeline

Thanks, this fixes the issue I was seeing.

cperciva added a reviewer: secteam.

This code looks correct to me, but I'm not an expert in these bits so it would be great if @manu or someone else with arm64 experience can review.

Adding secteam as a reviewer for visibility since this should get an Errata Notice.

This revision is now accepted and ready to land.Sun, Jan 4, 7:22 PM

This code looks correct to me, but I'm not an expert in these bits so it would be great if @manu or someone else with arm64 experience can review.

Adding secteam as a reviewer for visibility since this should get an Errata Notice.

Thanks, I added a placeholder for this.

Which FreeBSD versions does this bug affect? Looks like 15.0 and probably 14.3?

sys/arm64/arm64/exec_machdep.c
754

Why is it necessary to update the recorded ctx_size here? Below we are still only copying out sizeof(ctx) + buf_size bytes.

Which FreeBSD versions does this bug affect? Looks like 15.0 and probably 14.3?

It looks like that's correct. I didn't merge SVE support to 13.

sys/arm64/arm64/exec_machdep.c
754

It needs to be aligned correctly to point to the next entry. We could zero the padding, but userspace shouldn't care about it & the kernel doesn't read it back in on sigreturn.

sys/arm64/arm64/exec_machdep.c
754

Just to confirm, nothing is being written into that padding from the kernel? So having non-zeroed padding doesn't risk leaking information, it's just staying as whatever was there in userland already?

sys/arm64/arm64/exec_machdep.c
754

Correct

markj added inline comments.
sys/arm64/arm64/exec_machdep.c
754

That is my reading of it, yes.

This revision was automatically updated to reflect the committed changes.