Page MenuHomeFreeBSD

elfctl: fix operations with multiple features on multiple files
ClosedPublic

Authored by emaste on Feb 15 2022, 3:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 28, 9:03 PM
Unknown Object (File)
Nov 19 2025, 12:35 AM
Unknown Object (File)
Nov 18 2025, 10:33 AM
Unknown Object (File)
Nov 18 2025, 1:27 AM
Unknown Object (File)
Nov 17 2025, 3:21 PM
Unknown Object (File)
Nov 6 2025, 1:57 AM
Unknown Object (File)
Oct 29 2025, 1:39 PM
Unknown Object (File)
Oct 29 2025, 12:56 PM
Subscribers

Details

Summary

Previously an invocation like elfctl -e +feature1,feature2 file1 file2 would set both feature flags in file 1 but only feature1 in file2 due to strsep().

Reported by: jrm
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

emaste created this revision.

Looks good from a testing perspective.

jrm@phe /usr/obj/usr/src/amd64.amd64/usr.bin/elfctl % sudo ./elfctl -e '+noaslr,wxneeded' /usr/local/bin/ztop /usr/local/bin/zstd
jrm@phe /usr/obj/usr/src/amd64.amd64/usr.bin/elfctl % ./elfctl /usr/local/bin/ztop /usr/local/bin/zstd | grep 'noaslr\|wxneeded'
noaslr          'Disable ASLR' is set.
wxneeded        'Requires W+X mappings' is set.
noaslr          'Disable ASLR' is set.
wxneeded        'Requires W+X mappings' is set.
jrm@phe /usr/obj/usr/src/amd64.amd64/usr.bin/elfctl % sudo ./elfctl -e '-noaslr,wxneeded' /usr/local/bin/ztop /usr/local/bin/zstd
jrm@phe /usr/obj/usr/src/amd64.amd64/usr.bin/elfctl % ./elfctl /usr/local/bin/ztop /usr/local/bin/zstd | grep 'noaslr\|wxneeded'
noaslr          'Disable ASLR' is unset.
wxneeded        'Requires W+X mappings' is unset.
noaslr          'Disable ASLR' is unset.
wxneeded        'Requires W+X mappings' is unset.

There are a few minor, pre-existing whitespace issues (space inserted next to a tab) on lines 85, 409, 448.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2022, 1:43 PM
This revision was automatically updated to reflect the committed changes.