aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-05-09 16:22:54 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-05-20 08:33:30 -0700
commit5917b981c20de6ebc9bd1e44f7148b868c186627 (patch)
tree4be3b76d5c09918b85af4a607670e16966fccaff
parent3e00ebf234e4ef73c151668e6fd17bfc731dcd67 (diff)
downloadxfs-linux-5917b981c20de6ebc9bd1e44f7148b868c186627.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/Makefile17
-rw-r--r--fs/iomap/Makefile17
-rw-r--r--fs/xfs/Makefile23
4 files changed, 77 insertions, 0 deletions
diff --git a/fs/Makefile b/fs/Makefile
index 9c708e1fbe8fb..bf85e7bba7803 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -6,6 +6,26 @@
# Rewritten to use lists instead of if-statements.
#
+ccflags-y += -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 \
+-Wno-type-limits
+ccflags-$(CONFIG_KASAN) += -Wno-error
+
+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..78c47402f6f97 100644
--- a/fs/ext4/Makefile
+++ b/fs/ext4/Makefile
@@ -3,6 +3,23 @@
# Makefile for the linux ext4-filesystem routines.
#
+UBSAN_SANITIZE := y
+
+ccflags-y += -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=empty-body \
+-Wno-type-limits
+ccflags-$(CONFIG_KASAN) += -Wno-error
+
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..e46f936dde81b 100644
--- a/fs/iomap/Makefile
+++ b/fs/iomap/Makefile
@@ -3,6 +3,23 @@
# Copyright (c) 2019 Oracle.
# All Rights Reserved.
#
+ccflags-y += -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-type-limits
+ccflags-$(CONFIG_KASAN) += -Wno-error
+
+UBSAN_SANITIZE := y
ccflags-y += -I $(srctree)/$(src) # needed for trace events
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 04611a1068b49..dea35f71bb7aa 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -7,6 +7,29 @@
ccflags-y += -I $(srctree)/$(src) # needed for trace events
ccflags-y += -I $(srctree)/$(src)/libxfs
+ccflags-y += -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=address-of-packed-member \
+-Wno-error=format= \
+-Wno-type-limits
+ccflags-$(CONFIG_KASAN) += -Wno-error
+
+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