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

C implementation build on Linux x86_64 produces binaries with executable stack #109

Closed
tristanheaven opened this issue Aug 23, 2020 · 1 comment

Comments

@tristanheaven
Copy link

@tristanheaven tristanheaven commented Aug 23, 2020

Due to some GNU legacy/compatibility reasons, if an object file doesn't have a .note.GNU-stack section, it is assumed to require an executable stack when linked.

If the executable stack is not actually required, the solution is to add something like this into every .S file:

#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

Using the example program from the README, the result can be checked with the execstack tool, or by inspecting the /proc/$(pidof example)/maps of the running process:

Before

X example
7ffde499b000-7ffde49bc000 rwxp 00000000 00:00 0                          [stack]

After

- example
7ffdf5616000-7ffdf5637000 rw-p 00000000 00:00 0                          [stack]
@sneves
Copy link
Collaborator

@sneves sneves commented Aug 23, 2020

Ugh, I forgot about this. I'll fix this promptly. The question is, is this behavior also the default on the BSDs? I couldn't find a straight answer.

oconnor663 pushed a commit that referenced this issue Oct 1, 2020
Changes since 0.3.6:
- BUGFIX: The C implementation was incorrect on big endian systems for
  inputs longer than 1024 bytes. This bug affected all previous versions
  of the C implementation. Little endian platforms like x86 were
  unaffected. The Rust implementation was also unaffected.
  @jakub-zwolakowski and @pascal-cuoq from TrustInSoft reported this
  bug: #118
- BUGFIX: The C build on x86-64 was producing binaries with an
  executable stack. @tristanheaven reported this bug:
  #109
- @mkrupcale added optimized implementations for SSE2. This improves
  performance on older x86 processors that don't support SSE4.1.
- The C implementation now exposes the
  `blake3_hasher_init_derive_key_raw` function, to make it easier to
  implement language bindings. Added by @k0001.
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

No branches or pull requests

2 participants