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

Support for personality(2)? #1330

Closed
woodruffw opened this issue Nov 10, 2020 · 3 comments · Fixed by #1331
Closed

Support for personality(2)? #1330

woodruffw opened this issue Nov 10, 2020 · 3 comments · Fixed by #1331

Comments

@woodruffw
Copy link
Contributor

Hi there! Thanks a ton for these bindings, they're a pleasure to use.

Would the nix team be interested in support for the (Linux-specific) personality(2) syscall? It's currently supported in the libc crate but doesn't have higher level bindings to turn the persona argument into a bitflags! enum or to map the return value into a Result.

It's something I'm interested in (and capable of) implementing, if desired.

@asomers
Copy link
Member

asomers commented Nov 11, 2020

What's the main use? It seems to me like this should only be done by the ELF loader.

@woodruffw
Copy link
Contributor Author

I don't think the current dynamic linker/loader on Linux actually calls personality(2), although it may have in the past. Here are a few uses that I can think of:

  • Implementing a setarch(8)-style utility in Rust.

  • Allowing more fine-grained process spawning. This is my current use case: I want to disable ASLR on a few specific child processes for unit testing purposes.

  • Exposing an exec-safe piece of process state -- KRF currently uses personality(2) to signal to the kernel that a particular tree of processes should be instrumented. It's useful to be able to do that outside of the dynamic linker.

@bors bors bot closed this as completed in e65db13 Dec 19, 2020
@woodruffw
Copy link
Contributor Author

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants