summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-08-06 11:06:49 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-08-11 09:14:21 -0700
commit7f47a994841800acc1f0d7a9c897065e2c4d86ac (patch)
tree3edd771d752a706ef22f0f7cf390ee1d9478b556 /fs
parent9c5e092df754078cfff8990f8984d00129a357c2 (diff)
xfs: don't crash with assfail
Diffstat (limited to 'fs')
-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 f98f3e691c37..a374116ae8cb 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 49e7af6cc93f..78c47402f6f9 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 eef2722d93a1..e46f936dde81 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 04611a1068b4..dea35f71bb7a 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