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

configure.ac: correct stack protector check #99

Closed
wants to merge 1 commit into from
Closed

configure.ac: correct stack protector check #99

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 16, 2016

If a used toolchain accepts the -fstack-protector option but does not
provide a stack smashing protector implementation (ex. libssp), linking
will fail:

.libs/rpmio.o: In function Fdescr': rpmio.c:(.text+0x672): undefined reference to __stack_chk_fail_local'
.libs/rpmio.o: In function Fdopen': rpmio.c:(.text+0xce9): undefined reference to __stack_chk_fail_local'
.libs/rpmio.o: In function ufdCopy': rpmio.c:(.text+0x10f7): undefined reference to __stack_chk_fail_local'
...

This is a result of testing for -fstack-protector support using a main
that GCC does not inject guards. GCC's manual notes that stack protector
code is only added when "[functions] that call alloca, and functions
with buffers larger than 8 bytes" 1. This commit adjusts the stack
protector check to allocate memory on the stack (via alloca).

Signed-off-by: James Knight james.knight@rockwellcollins.com

If a used toolchain accepts the `-fstack-protector` option but does not
provide a stack smashing protector implementation (ex. libssp), linking
will fail:

 .libs/rpmio.o: In function `Fdescr':
 rpmio.c:(.text+0x672): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `Fdopen':
 rpmio.c:(.text+0xce9): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `ufdCopy':
 rpmio.c:(.text+0x10f7): undefined reference to `__stack_chk_fail_local'
 ...

This is a result of testing for `-fstack-protector` support using a main
that GCC does not inject guards. GCC's manual notes that stack protector
code is only added when "[functions] that call alloca, and functions
with buffers larger than 8 bytes" [1]. This commit adjusts the stack
protector check to allocate memory on the stack (via `alloca`).

[1]: https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html

Signed-off-by: James Knight <james.knight@rockwellcollins.com>
@dnf-bot
Copy link
Member

dnf-bot commented Nov 16, 2016

Can one of the admins verify this patch?

Copy link
Member

@Conan-Kudo Conan-Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ffesti
Copy link
Contributor

ffesti commented Nov 18, 2016

Thanks for the patch! Merged.

@ffesti ffesti closed this Nov 18, 2016
@ghost ghost deleted the ssp-fix branch November 18, 2016 15:37
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 this pull request may close these issues.

None yet

3 participants