aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2021-01-11 15:18:20 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-01-11 15:18:20 -0800
commitff344abb1b45079f292cf90e039ce0c5f7ee9988 (patch)
tree309455ea70deed879c41fb254a88fdfd3cacfc06
parent6a886f69ae7a72c1b637cfd288d397b16200409d (diff)
downloadxfs-linux-ff344abb1b45079f292cf90e039ce0c5f7ee9988.tar.gz
xfs: don't crash with assfail
Notice: this object is not reachable from any branch.
Notice: this object is not reachable from any branch.
-rw-r--r--fs/Makefile20
-rw-r--r--fs/ext4/Makefile15
-rw-r--r--fs/iomap/Makefile17
-rw-r--r--fs/xfs/Makefile21
4 files changed, 73 insertions, 0 deletions
diff --git a/fs/Makefile b/fs/Makefile
index 999d1a23f036c..88ba1ae151a68 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -6,6 +6,26 @@
# Rewritten to use lists instead of if-statements.
#
+ccflags-$(CONFIG_KASAN) += -Wno-error
+ccflags-y += -g \
+-Werror \
+-femit-struct-debug-detailed=any \
+-Wunused-but-set-variable \
+-Wuninitialized \
+-Wno-pointer-sign \
+-Wall \
+-Wextra \
+-Wno-unused-parameter \
+-fstack-usage \
+-Wno-sign-compare \
+-Wno-ignored-qualifiers \
+-Wno-error=unused-but-set-variable \
+-Wno-error=format= \
+-Wno-error=empty-body \
+-Wno-error=missing-field-initializers
+
+UBSAN_SANITIZE := y
+
obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
ioctl.o readdir.o select.o dcache.o inode.o \
diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile
index 49e7af6cc93ff..ea66191d6d87f 100644
--- a/fs/ext4/Makefile
+++ b/fs/ext4/Makefile
@@ -3,6 +3,21 @@
# Makefile for the linux ext4-filesystem routines.
#
+UBSAN_SANITIZE := y
+
+ccflags-y += -g # -Werror
+ccflags-$(CONFIG_KASAN) += -Wno-error
+ccflags-y += -femit-struct-debug-detailed=any \
+-Wunused-but-set-variable \
+-Wuninitialized \
+-Wno-pointer-sign \
+-Wall \
+-Wextra \
+-Wno-unused-parameter \
+-fstack-usage \
+-Wno-sign-compare \
+-Wno-ignored-qualifiers
+
obj-$(CONFIG_EXT4_FS) += ext4.o
ext4-y := balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \
diff --git a/fs/iomap/Makefile b/fs/iomap/Makefile
index eef2722d93a18..e7074dffa922d 100644
--- a/fs/iomap/Makefile
+++ b/fs/iomap/Makefile
@@ -3,6 +3,23 @@
# Copyright (c) 2019 Oracle.
# All Rights Reserved.
#
+ccflags-$(CONFIG_KASAN) += -Wno-error
+ccflags-y += -g \
+-Werror \
+-femit-struct-debug-detailed=any \
+-Wunused-but-set-variable \
+-Wuninitialized \
+-Wno-pointer-sign \
+-Wall \
+-Wextra \
+-Wno-unused-parameter \
+-fstack-usage \
+-Wno-sign-compare \
+-Wno-ignored-qualifiers \
+-Wno-error=unused-but-set-variable \
+-Wno-error=format=
+
+UBSAN_SANITIZE := y
ccflags-y += -I $(srctree)/$(src) # needed for trace events
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 04611a1068b49..0400f27994d98 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -7,6 +7,27 @@
ccflags-y += -I $(srctree)/$(src) # needed for trace events
ccflags-y += -I $(srctree)/$(src)/libxfs
+ccflags-$(CONFIG_XFS_DEBUG) += -Werror
+ccflags-$(CONFIG_KASAN) += -Wno-error
+ccflags-y += -femit-struct-debug-detailed=any \
+-Wunused-but-set-variable \
+-Wuninitialized \
+-Wno-pointer-sign \
+-Wall \
+-Wextra \
+-Wno-unused-parameter \
+-fstack-usage \
+-Wno-sign-compare \
+-Wno-ignored-qualifiers \
+-Wno-error=unused-but-set-variable \
+-Wno-error=format=
+
+ifneq ($(CONFIG_XFS_QUOTA),y)
+ccflags-y += -Wno-error=empty-body
+endif
+
+UBSAN_SANITIZE := y
+
obj-$(CONFIG_XFS_FS) += xfs.o
# this one should be compiled first, as the tracing macros can easily blow up