Page MenuHomePhabricator

[sanitizer] remove PS_STRINGS fallback on FreeBSD
ClosedPublic

Authored by emaste on Apr 12 2016, 12:46 PM.

Details

Summary

The PS_STRINGS constant can easily be incorrect with mismatched kernel/userland - e.g. when building i386 sanitizers on FreeBSD/amd64 with -m32. The kern.ps_strings sysctl exists on all supported versions of FreeBSD and is the supported way to get the environment and argument strings, so we never use the PS_STRINGS fallback. Just remove it.

Diff Detail

Repository
rL LLVM

Event Timeline

emaste updated this revision to Diff 53443.Apr 12 2016, 12:46 PM
emaste retitled this revision from to [sanitizer] remove PS_STRINGS fallback on FreeBSD.
emaste updated this object.
emaste added reviewers: samsonov, dim, davide.
emaste added a subscriber: llvm-commits.
davide accepted this revision.Apr 12 2016, 2:55 PM
davide edited edge metadata.

This is reasonable to me. Filipe, what do you think?

This revision is now accepted and ready to land.Apr 12 2016, 2:55 PM

I'm hoping to eventually move PS_STRINGS to be for the FreeBSD kernel only, and have started removing uses from the FreeBSD base system: https://svnweb.freebsd.org/changeset/base/297888

filcab edited edge metadata.Apr 14 2016, 5:49 AM

This seems to be in line with the rest of your commits in FreeBSD's base system, so LGTM.

filcab added a subscriber: filcab.Apr 14 2016, 5:52 AM

Well, there's another point of view. Do we care about keeping the
PS_STRINGS for FreeBSD < 11? (Possibly <10.4 or <10.3)

Thank you,

Filipe
emaste added a comment.EditedApr 14 2016, 7:14 AM

Well, there's another point of view. Do we care about keeping the
PS_STRINGS for FreeBSD < 11? (Possibly <10.4 or <10.3)

No, there's no need. I made a mistake in my FreeBSD commit message when I said kern.ps_strings is available in any FreeBSD release supported within the last decade -- it's actually much longer.

kern.ps_strings was actually introduced in r14235 over 20 years ago: https://svnweb.freebsd.org/changeset/base/14235
And in 1998 it was understood that "applications should use the kern.ps_strings sysctl instead of PS_STRINGS": https://svnweb.freebsd.org/changeset/base/41871

This revision was automatically updated to reflect the committed changes.