Set stack frame limit
For all module/library functions ensure so stack frame exceeds 1024 bytes. Ideally this should be set lower to say 512 bytes but there are still numerous functions which exceed even this limit. For now this is set to 1024 to ensure we catch the worst offenders. Additionally, set the limit for ztest to 1024 bytes since the idea here is to catch stack issues in user space before we find them by overrunning a kernel stack. This should also be reduced to 512 bytes as soon as all the trouble makes are fixed. Finally, add -fstack-check to gcc build options when --enable-debug is specified at configure time. This ensures that each page on the stack will be touched and we will generate a segfault on stack overflow. Over time we can gradually fix the following functions: 536 zfs:dsl_deadlist_regenerate 536 zfs:dsl_load_sets 536 zfs:zil_parse 544 zfs:zfs_ioc_recv 552 zfs:dsl_deadlist_insert_bpobj 552 zfs:vdev_dtl_sync 584 zfs:copy_create_perms 608 zfs:ddt_class_contains 608 zfs:ddt_prefetch 608 zfs:__dprintf 616 zfs:ddt_lookup 648 zfs:dsl_scan_ddt 696 zfs:dsl_deadlist_merge 736 zfs:ddt_zap_walk 744 zfs:dsl_prop_get_all_impl 872 zfs:dnode_evict_dbufs
This commit is contained in:
parent
843af873bf
commit
9af7aa53eb
|
@ -1,5 +1,7 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
|
AM_CFLAGS += -Wframe-larger-than=1024
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
DEFAULT_INCLUDES += \
|
||||||
-I${top_srcdir}/lib/libspl/include \
|
-I${top_srcdir}/lib/libspl/include \
|
||||||
-I${top_srcdir}/lib/libefi/include \
|
-I${top_srcdir}/lib/libefi/include \
|
||||||
|
|
|
@ -24,7 +24,7 @@ if test "$zfs_ac_debug" = yes; then
|
||||||
[Define to 1 to enable debug tracing])
|
[Define to 1 to enable debug tracing])
|
||||||
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG "
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG "
|
||||||
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG "
|
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG "
|
||||||
USERDEBUG="-DDEBUG"
|
USERDEBUG="-DDEBUG -fstack-check"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
AC_DEFINE([NDEBUG], [1],
|
AC_DEFINE([NDEBUG], [1],
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
|
AM_CFLAGS += -Wframe-larger-than=1024
|
||||||
|
|
||||||
SUBDIRS = include
|
SUBDIRS = include
|
||||||
DEFAULT_INCLUDES += \
|
DEFAULT_INCLUDES += \
|
||||||
-I${top_srcdir}/lib/libzpool/include \
|
-I${top_srcdir}/lib/libzpool/include \
|
||||||
|
|
Loading…
Reference in New Issue