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

criterion: disabling aslr for testcases #1753

Merged
merged 1 commit into from
Nov 14, 2017

Conversation

furiel
Copy link
Collaborator

@furiel furiel commented Nov 10, 2017

Parametrized tests in criterion crashes with aslr enabled.
Snaipe/Criterion#208

This can be a problem, because for example in ubuntu 17.04 gcc
produces position independent executable code by default. With
randomize_va_space > 0, it leads criterion tests to crash.

This patch will compile the tests into a non position independent
binary, avoiding the crash.
Non test related binaries are untouched.

Test:
$ file modules/xml/tests/test_xml_parser
modules/xml/tests/test_xml_parser: ELF 64-bit LSB executable [...]

However for syslog-ng binary:
$ file ../root/sbin/syslog-ng
../root/sbin/syslog-ng: ELF 64-bit LSB shared object

@furiel
Copy link
Collaborator Author

furiel commented Nov 10, 2017

I needed to remove the quotes in LDFLAGS+=${test_ldflags}. The reason is I got compiler errors: "-no-install -no-pie" is passed as a single argument to the linker, resulting in error.

@kira-syslogng
Copy link
Contributor

Build SUCCESS, the tests were executed on test branch: master and test suite: functions

@furiel
Copy link
Collaborator Author

furiel commented Nov 10, 2017

Adding detection for -no-pie, as it seems we cannot expect it to be available on every system.

Parametrized tests in criterion crashes with aslr enabled.
Snaipe/Criterion#208

This can be a problem, because for example in ubuntu 17.04 gcc
produces position  independent executable code by default. With
randomize_va_space > 0, it would lead criterion tests to crash.

This patch will compile the tests into a non position independent
binary, avoiding the crash.
Non test related binaries are untouched.

One can check if a binary is non-pie by:

$ file modules/xml/tests/test_xml_parser
modules/xml/tests/test_xml_parser: ELF 64-bit LSB executable [...]

However for syslog-ng binary:
$ file ../root/sbin/syslog-ng
../root/sbin/syslog-ng: ELF 64-bit LSB shared object

Signed-off-by: Antal Nemes <antal.nemes@balabit.com>
@kira-syslogng
Copy link
Contributor

Build SUCCESS, the tests were executed on test branch: master and test suite: functions

@lbudai lbudai merged commit 5b4dbce into syslog-ng:master Nov 14, 2017
@furiel furiel deleted the criterion-aslr branch May 8, 2018 04:53
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