-
Notifications
You must be signed in to change notification settings - Fork 3
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
Makefile: Apply minimum hardening to libs and applications. #33
base: main
Are you sure you want to change the base?
Conversation
besser82
commented
Dec 22, 2024
- -Wl,-z,defs: Disallows undefined symbols at link-time.
- -Wl,-z,relro: Relocation Read-Only protects the Global Offset Table (GOT) in ELF binaries from being overwritten.
- -Wl,-z,now: Tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is loaded.
This kind of options are normally applied by the distro, not by flags coming from the package itself, but for a rather system-specific package like this I suppose we may. On Owl, our patched Is the name |
That flag ensures that there are no undefined symbols left during link-time, and thus should be used toghether with
Yes, the idea is to have them applied even if |
Given that all of |
I think the intent is to use it for compiler flags as well, so no... or would we prefer two variables? |
The compiler flags should be passed to the linker as well (because of LTO), but the linker-only flags don't have to be passed to the compiler (they would be ignored). If the idea is to have a single variable for both, then the patch is good as it is. |
e78d7c7
to
1ac0ac7
Compare
Rebased onto main, and updated to not required an additional variable. |
So now the idea is to have those hardening flags where appropriate in all builds, and if a build doesn't want them it has to pass the corresponding @ldv-alt What do you think? |
Just to give abit more of context: Those flags are supported since gcc v4.0, and define the absolute minimum of portable hardening; the same flags are the ones applied to packages like shadow-utils and alike by default since RHEL 5 or so. |
1ac0ac7
to
b52ec3f
Compare
This enables stack-protector-strong with _FORTIFY_SOURCE=2, and the following linker flags: -Wl,-z,defs: Disallows undefined symbols at link-time. -Wl,-z,relro: Relocation Read-Only protects the Global Offset Table (GOT) in ELF binaries from being overwritten. -Wl,-z,now: Tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is loaded. Signed-off-by: Björn Esser <[email protected]>
b52ec3f
to
947c61d
Compare
That's not quite true. gcc 4.6.3 that we had in Owl (until we've essentially stopped maintaining it) recognizes Also, we're running into some issue on linking, but maybe that's a gcc bug or our gcc packaging bug?
|