mctp-netlink: Cleanups from a -Db_sanitize=address,undefined build run in a target environment#131
Open
amboar wants to merge 3 commits intoCodeConstruct:mainfrom
Open
mctp-netlink: Cleanups from a -Db_sanitize=address,undefined build run in a target environment#131amboar wants to merge 3 commits intoCodeConstruct:mainfrom
amboar wants to merge 3 commits intoCodeConstruct:mainfrom
Conversation
Mitigate the following ubsan splat:
Feb 27 09:32:23 test mctpd[1034]: ../git/src/mctp-netlink.c:960:3: runtime error: null pointer passed as argument 1, which is declared to never be null
Feb 27 09:32:23 test mctpd[1034]: #0 0x4552c4 (/usr/sbin/mctpd+0x4a2c4) (BuildId: 0a2c71201a0ddde8f9bbe7d2fd65628c4e08f5d8)
Feb 27 09:32:23 test mctpd[1034]: CodeConstruct#1 0x42c3b0 (/usr/sbin/mctpd+0x213b0) (BuildId: 0a2c71201a0ddde8f9bbe7d2fd65628c4e08f5d8)
Feb 27 09:32:23 test mctpd[1034]: CodeConstruct#2 0xa623b4ac (/usr/lib/libc.so.6+0x1f4ac) (BuildId: f7dfc12cfaed3ca290b3c7f41ef9145c0de0fe6b)
Feb 27 09:32:23 test mctpd[1034]: CodeConstruct#3 0xa623b598 in __libc_start_main (/usr/lib/libc.so.6+0x1f598) (BuildId: f7dfc12cfaed3ca290b3c7f41ef9145c0de0fe6b)
glibc (e.g. 2.41) declares qsort as:
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) __nonnull ((1, 4));
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Mitigate the ubsan splat:
Feb 27 09:30:55 test mctpd[984]: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../../../../workspace/sources/mctp/src/mctp-netlink.c:1102:2 in
Feb 27 09:31:00 test mctpd[993]: ../../../../../../workspace/sources/mctp/src/mctp-netlink.c:1102:2: runtime error: null pointer passed as argument 2, which is declared to never be null
Feb 27 09:31:00 test mctpd[993]: #0 0x47fcc0 (/usr/sbin/mctpd+0x57cc0) (BuildId: 74658a0b3317f1295bab6bbcd8febf809768bfda)
Feb 27 09:31:00 test mctpd[993]: CodeConstruct#1 0x459590 (/usr/sbin/mctpd+0x31590) (BuildId: 74658a0b3317f1295bab6bbcd8febf809768bfda)
Feb 27 09:31:00 test mctpd[993]: CodeConstruct#2 0x4498f0 (/usr/sbin/mctpd+0x218f0) (BuildId: 74658a0b3317f1295bab6bbcd8febf809768bfda)
Feb 27 09:31:00 test mctpd[993]: CodeConstruct#3 0xa62904ac (/usr/lib/libc.so.6+0x1f4ac) (BuildId: f7dfc12cfaed3ca290b3c7f41ef9145c0de0fe6b)
Feb 27 09:31:00 test mctpd[993]: CodeConstruct#4 0xa6290598 in __libc_start_main (/usr/lib/libc.so.6+0x1f598) (BuildId: f7dfc12cfaed3ca290b3c7f41ef9145c0de0fe6b)
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Member
|
Nice. Should we be doing some UBSANning in CI? |
Member
|
aww, we can't pass NULL even when we're representing the size as zero? |
Given we were already enabling ASAN and there were a couple of UBSAN bugs, let's enable UBSAN too. Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
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.
I was doing some testing a while back and found a couple of minor issues. Rediscovered them today.