Lines Matching +full:zero +full:- +full:based
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Test cases for compiler-based stack variable zeroing via
4 * -ftrivial-auto-var-init={zero,pattern} or CONFIG_GCC_PLUGIN_STRUCTLEAK*.
6 * "Running tests with kunit_tool" at Documentation/dev-tools/kunit/start.rst
7 * ./tools/testing/kunit/kunit.py run stackinit [--raw_output] \
8 * --make_option LLVM=1 \
9 * --kconfig_add CONFIG_INIT_STACK_ALL_ZERO=y
81 #define ZERO_CLONE_SCALAR(zero) memset(&(zero), 0x00, sizeof(zero)) argument
82 #define ZERO_CLONE_STRING(zero) memset(&(zero), 0x00, sizeof(zero)) argument
87 #define ZERO_CLONE_STRUCT(zero) \ argument
89 memset(&(zero), 0xFF, sizeof(zero)); \
90 zero.one = 0; \
91 zero.two = 0; \
92 zero.three = 0; \
93 zero.four = 0; \
112 #define __dynamic_partial { .two = arg->two, }
113 #define __dynamic_all { .one = arg->one, \
114 .two = arg->two, \
115 .three = arg->three, \
116 .four = arg->four, \
160 var_type zero INIT_CLONE_ ## which; \
165 BUILD_BUG_ON(sizeof(zero) > MAX_VAR_SIZE); \
167 /* Fill clone type with zero for per-field init. */ \
168 ZERO_CLONE_ ## which(zero); \
173 FETCH_ARG_ ## which(zero)); \
179 /* Extract stack-defined variable contents. */ \
181 FETCH_ARG_ ## which(zero)); \
196 (int)((ssize_t)(uintptr_t)fill_start - \
211 /* no-op to force compiler into ignoring "uninitialized" vars */\
251 return (int)buf[0] | (int)buf[sizeof(buf) - 1]; \
286 /* "sizeof(unsigned long) - 1" byte padding hole here. */
347 DEFINE_SCALAR_TESTS(zero, ALWAYS_PASS);
348 DEFINE_STRUCT_TESTS(zero, ALWAYS_PASS);
372 * warning, build with -Wno-switch-unreachable in __leaf_switch_none()
420 * non-code areas (i.e. in a switch statement before the first "case").
441 KUNIT_test_scalars(zero),
442 KUNIT_test_structs(zero),
475 MODULE_DESCRIPTION("Test cases for compiler-based stack variable zeroing");