-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
 Support -fsanitizer=address in user space #6941
Conversation
bc0d4a5
to
efc1579
Compare
This PR is working as expected when enabled in the buildbot. In fact, it currently detects at least one leak in @DeHackEd it would be great if you could look these changes over.
|
efc1579
to
d981858
Compare
LGTM, though it feels like the last commit contains a mixture of code cleanup, debuginfo management, and ASAN all in one. From my older patch I was hitting a refcount memory leak, but for some reason I wasn't getting stack frames below that so I don't know where the actual leak originates. Did you find that one? Still, like you said this isn't a blocker for the time being - just want to make sure this is on the radar. |
Yes, I can split this up if you like I did end up doing a little more clean than originally intended.
Yes, I saw this as well and was confused about the lack of a stack frame identifying the leak location. This still needs to be explained and run down. I did not observed this initially on CentOS 7, presumably due to the much older version of the tool chain. Surprisingly this change also appears to be causing reliably failures for CentOS 6 which I need to run down. I'll see about splitting up this PR in to different PRs so so the more trivial patches can be merged and the root cause the for the CentOS 6 segfaults identified. |
kmem_alloc(0, ...) in userspace returns a leakable pointer. Signed-off-by: DHE <git@dehacked.net>
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
When --enable-asan is provided to configure then build all user space components with fsanitize=address. For kernel support use the Linux KASAN feature instead. https://github.com/google/sanitizers/wiki/AddressSanitizer When using gcc version 4.8 any test case which intentionally generates a core dump will fail when using --enable-asan. The default behavior is to disable core dumps and only newer versions allow this behavior to be controled at run time with the ASAN_OPTIONS environment variable. Additionally, this patch includes some build system cleanup. * Rules.am updated to set the minimum AM_CFLAGS, AM_CPPFLAGS, and AM_LDFLAGS. Any additional flags should be added on a per-Makefile basic. The --enable-debug and --enable-asan options apply to all user space binaries and libraries. * Compiler checks consolidated in always-compiler-options.m4 and renamed for consistency. * -fstack-check compiler flags was moved from DEBUG_STACKFLAGS in to DEBUG_CFLAGS for clarity. Set with --enable-debug. * Split DEBUG_CFLAGS in to DEBUG_CFLAGS, DEBUG_CPPFLAGS, and DEBUG_LDFLAGS. * Moved default kernel build flags in to module/Makefile.in and split in to ZFS_MODULE_CFLAGS and ZFS_MODULE_CPPFLAGS. These flags are set with the standard ccflags-y kbuild mechanism. * -Wframe-larger-than checks applied only to binaries or libraries which include source files which are built in both user space and kernel space. This restriction is relaxed for user space only utilities. * -Wno-unused-but-set-variable applied only to libzfs and libzpool. The remaining warnings are the result of an ASSERT using a variable when is always declared. Signed-off-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
d981858
to
eceb928
Compare
Codecov Report
@@ Coverage Diff @@
## master #6941 +/- ##
==========================================
- Coverage 75.4% 75.31% -0.09%
==========================================
Files 296 296
Lines 95483 95489 +6
==========================================
- Hits 72002 71921 -81
- Misses 23481 23568 +87
Continue to review full report at Codecov.
|
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue #6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #6941
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue openzfs#6941
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue openzfs#6941
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue openzfs#6941
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue openzfs#6941
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
kmem_alloc(0, ...) in userspace returns a leakable pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Issue openzfs#6941
In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Resolved unused variable warnings observed after restricting -Wno-unused-but-set-variable to only libzfs and libzpool. Reviewed-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#6941
Description
When
--enable-asan
is provided to configure build all user space components with-fsanitize=address
. For kernel support use the Linux KASAN feature instead.https://github.com/google/sanitizers/wiki/AddressSanitizer
When using gcc version 4.8 any test case which intentionally generates a core dumps will fail when using
--enable-asan
. The default behavior is to disable core dumps and only newer versions allow this behavior to be controled at run time with the ASAN_OPTIONS environment variable.Motivation and Context
Primarily motivated and based on @DeHackEd's changes in #6884 to make it possible to use
-fsanitizer=address
withztest
. Since the support is optionally enabled I've extended it to cover all of user space. The intention is to eventually enable it in buildbot to improve the automated testing.How Has This Been Tested?
Locally verified on CentOS 7, pushed to the buildbot to verify the build system changes. Additional manual local testing is needed.
Types of changes
Checklist:
Signed-off-by
.