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
89 #define ZERO_CLONE_SCALAR(zero) memset(&(zero), 0x00, sizeof(zero)) argument
90 #define ZERO_CLONE_STRING(zero) memset(&(zero), 0x00, sizeof(zero)) argument
95 #define ZERO_CLONE_STRUCT(zero) \ argument
97 memset(&(zero), 0xFF, sizeof(zero)); \
98 zero.one = 0; \
99 zero.two = 0; \
100 zero.three = 0; \
101 zero.four = 0; \
103 #define ZERO_CLONE_UNION(zero) ZERO_CLONE_STRUCT(zero) argument
122 #define __dynamic_partial { .two = arg->two, }
123 #define __dynamic_all { .one = arg->one, \
124 .two = arg->two, \
125 .three = arg->three, \
126 .four = arg->four, \
190 * pattern bytes are compiler, architecture, and type based,
207 var_type zero INIT_CLONE_ ## which; \
212 BUILD_BUG_ON(sizeof(zero) > MAX_VAR_SIZE); \
214 /* Fill clone type with zero for per-field init. */ \
215 ZERO_CLONE_ ## which(zero); \
220 FETCH_ARG_ ## which(zero)); \
226 /* Extract stack-defined variable contents. */ \
228 FETCH_ARG_ ## which(zero)); \
244 (int)((ssize_t)(uintptr_t)fill_start - \
259 /* no-op to force compiler into ignoring "uninitialized" vars */\
299 return (int)buf[0] | (int)buf[sizeof(buf) - 1]; \
334 /* "sizeof(unsigned long) - 1" byte padding hole here. */
437 DEFINE_SCALAR_TESTS(zero, ALWAYS_PASS);
438 DEFINE_STRUCT_TESTS(zero, ALWAYS_PASS);
440 DEFINE_UNION_TESTS(zero, ALWAYS_PASS);
471 * warning, build with -Wno-switch-unreachable in __leaf_switch_none()
519 * non-code areas (i.e. in a switch statement before the first "case").
545 KUNIT_test_scalars(zero),
546 KUNIT_test_structs(zero),
548 KUNIT_test_unions(zero),
593 MODULE_DESCRIPTION("Test cases for compiler-based stack variable zeroing");