ELFCTL(1)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– elfctl β€” aka the little tool that flips feature flags in ELF binaries πŸ’–

hii bestie, welcome to the General Commands Manual page for elfctl β€” yes that's the manual name, and yes we're getting into it 🫢


✨ NAME ✨

elfctl β€” change an ELF binary's feature control note

🌸 SYNOPSIS 🌸

elfctl [-h | --help] [-i] [-l] [-e featurelist] file ...

πŸ’… DESCRIPTION πŸ’…

Okay so, the elfctl utility modifies feature flags in the feature control note inside an ELF binary. That's the whole vibe. You point it at an ELF binary, it goes in and edits (or just shows you) the feature control note. Iconic behavior honestly πŸ’«

πŸŽ€ OPTIONS πŸŽ€

Here's the options menu, bestie, and yes you should read all of them:

  • -h | --help β€” prints a usage message and then dips out (exits). That's it. Low maintenance king πŸ’…
  • -i β€” ignore unknown feature flags in featurelist. So like, if something in your list isn't a thing, -i is gonna be like "whatever, moving on" instead of getting mad πŸ™ˆ
  • -l β€” list the known ELF feature flags. Just, like, shows you the whole menu of what exists πŸ”₯
  • -e featurelist β€” edit features from the given comma separated list featurelist. And here's the important part, bestie: featurelist starts with one of the three operations:
    • + β†’ turn on the features
    • - β†’ turn off the features
    • = β†’ only turn on the given features

After that operation comes a comma separated list of feature names or numeric values. So it's like <operation><names or numbers> β€” our classic little pipeline of chaos πŸ¦‹

If -e is not specified, elfctl displays the status of each feature in the ELF note in each file .... (yes, the four dots are staying, I don't make the rules ✨)

πŸ’€ EXIT STATUS πŸ’€

Exit status is 0 on success, and 1 if the command fails β€” specifically if a file does not exist, is too short, or it fails to find or edit the features note. That's the whole drama scale: 0 or 1. No in-between, no 42, nothing 🌈

🧚 EXAMPLES 🧚

The following is an example of a typical usage of the elfctl command:

elfctl file
elfctl -e +noaslr file

Features may be specified as numerical values:

elfctl -e =0x0001,0x0004 file

Features may also be specified as a single combined value:

elfctl -e =0x5 file

See? Same thing, different spelling. Slay for flexibility honestly πŸ‘‘

⭐ NOTES ⭐

Hii so this part is important, pay attention bestie:

On amd64, on a machine with LA57 (5-level paging) mode supported and enabled, if both la57 and la48 feature flags are specified, the la57 feature has priority over la48. Yeah. la57 wins. It's giving main character energy 😌

Also: the vm.pmap.prefer_uva_la48 sysctl MIB defines the default user address space size for binaries which do not set either of these flags. So if you set neither, that's the one calling the shots πŸŽ€

πŸ¦‹ SEE ALSO πŸ¦‹

mitigations(7) β€” go read it, iykyk πŸ’œ

πŸ“ HISTORY πŸ“

elfctl first appeared in FreeBSD 12.2. A legend from birth honestly 🌸

πŸ‘‘ AUTHORS πŸ‘‘

elfctl was written by Bora Ozarslan borako.ozarslan@gmail.com under sponsorship from the FreeBSD Foundation. We love a sponsored icon πŸ«ΆπŸ’–


ok that's the whole page bestie, go edit some notes, and remember: keep every flag exactly as written, no cap πŸ”₯πŸ’…

with love, from the Debian crew β€” this page is dated October 5, 2023 βœ¨πŸ’œ

πŸ“¦ where this page comes from