func_tests: disable FORTIFY_SOURCE for test_1_to_1_recvfrom#67
Open
kraj wants to merge 1 commit intosctp:masterfrom
Open
func_tests: disable FORTIFY_SOURCE for test_1_to_1_recvfrom#67kraj wants to merge 1 commit intosctp:masterfrom
kraj wants to merge 1 commit intosctp:masterfrom
Conversation
When built with glibc hardening (_FORTIFY_SOURCE), recvfrom() is wrapped by __recvfrom_chk(). The test_1_to_1_recvfrom test deliberately calls recvfrom() with an invalid buffer pointer ((char *)-1) to verify that EFAULT is returned. On fortified builds, __recvfrom_chk() sees a buffer size of 0 and a non-zero length, treats this as a buffer overflow, and aborts with: *** buffer overflow detected ***: terminated This causes the test to fail with SIGABRT instead of exercising the kernel’s EFAULT path as intended. Compile test_1_to_1_recvfrom without _FORTIFY_SOURCE so that the test can run to completion and correctly validate the EFAULT behavior, while keeping fortify enabled for the rest of code Signed-off-by: Khem Raj <raj.khem@gmail.com>
Contributor
|
I couldn't trigger it with: Can you show how the error '*** buffer overflow detected ***: terminated' was triggered on your env? Thanks. |
Author
I think you need glibc to be compiled with hardening options as well like what yocto does. Configure glibc build with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When built with glibc hardening (_FORTIFY_SOURCE), recvfrom() is wrapped by __recvfrom_chk(). The test_1_to_1_recvfrom test deliberately calls recvfrom() with an invalid buffer pointer ((char *)-1) to verify that EFAULT is returned.
On fortified builds, __recvfrom_chk() sees a buffer size of 0 and a non-zero length, treats this as a buffer overflow, and aborts with:
*** buffer overflow detected ***: terminated
This causes the test to fail with SIGABRT instead of exercising the kernel’s EFAULT path as intended.
Compile test_1_to_1_recvfrom without _FORTIFY_SOURCE so that the test can run to completion and correctly validate the EFAULT behavior, while keeping fortify enabled for the rest of code