Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix aliasing UB in scmp_bpf_sim #433

Closed
wants to merge 1 commit into from

Conversation

thesamesam
Copy link
Contributor

See #425.

Punning sys_data_b between uint32_t* and struct* seccomp_data isn't legal, use memcpy to fix the testsuite with Clang 17.

Modern compilers recognise this idiom and optimise it out anyway.

See seccomp#425.

Punning sys_data_b between uint32_t* and struct* seccomp_data isn't legal,
use memcpy to fix the testsuite with Clang 17.

Modern compilers recognise this idiom and optimise it out anyway.

Signed-off-by: Sam James <sam@gentoo.org>
@coveralls
Copy link

Coverage Status

coverage: 89.454%. remained the same
when pulling 4f354f4 on thesamesam:alias-ub
into 9da5d17 on seccomp:main.

@pcmoore pcmoore changed the title scmp_bpf_sim: fix aliasing UB BUG: fix aliasing UB in scmp_bpf_sim Jun 24, 2024
@pcmoore pcmoore added this to the v2.6.0 milestone Jun 24, 2024
@RossComputerGuy
Copy link

Still experiencing failures with LLVM 17.0.6 https://termbin.com/j2ey

@thesamesam
Copy link
Contributor Author

thesamesam commented Jul 25, 2024

I can't reproduce that, I'm afraid. I get failures if I revert my patch, but it passes otherwise.

Are you sure it was applied? I also can't see anything obvious that would cause yours if the patch is applied.

@RossComputerGuy
Copy link

Are you sure it was applied?

I am 100% the patch is applied, I'm using Nix and it would fail if the patch failed to apply. It said the patch was applied.

@thesamesam
Copy link
Contributor Author

thesamesam commented Jul 25, 2024

No idea then, unfortunately. You'll need to try debug it. The full build log could also be useful but I don't see myself able to spend more time on a failure I can't reproduce if it's not caused by my PR, sorry.

I suggest starting with object files from a good and bad tree and bisecting via those.

Copy link
Member

@drakenclimber drakenclimber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. Thanks, @thesamesam

Acked-by: Tom Hromatka <tom.hromatka@oracle.com>

@pcmoore
Copy link
Member

pcmoore commented Sep 5, 2024

Merged via 2847f10, thanks for following through with this fix @thesamesam. If anyone is still seeing failures with this patch applies, please open a new issue so we can debug it further.

@pcmoore pcmoore closed this Sep 5, 2024
@thesamesam
Copy link
Contributor Author

Thanks all!

@thesamesam thesamesam deleted the alias-ub branch September 5, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants