debugobject: fix concurrency issues with is_static_object
Subsystems (2)
PATCH v2 1/2 debugobject: fix concurrency issues with is_static_object
The is_static_object implementation relay on the initial state of the object. If multiple places are accessed concurrently, there is a probability that the debug object has been registered in the system, which will invalidate the judgment of is_static_object.
The following is the scenario where the problem occurs:
T0 T1
=========================================================================mod_timer();
debug_object_assert_init
db = get_bucket((unsigned long) addr);
raw_spin_lock_irqsave(&db->lock, flags);
obj = lookup_object(addr, db);
if (!obj) {
raw_spin_unlock_irqrestore(&db->lock, flags);
<< Context switch >>
mod_timer();
debug_object_assert_init
...
enqueue_timer();
/*
* The initial state changed a static timer object, and
* is_static_object will return false
*/
if (descr->is_static_object &&
descr->is_static_object(addr)) {
debug_object_init();
} else {
<< Hit here for a static object >>
debug_print_object(&o, "assert_init");
debug_object_fixup(descr->fixup_assert_init, addr,
ODEBUG_STATE_NOTAVAILABLE);
}
}To fix it, we got the is_static_object called within db->lock, and save it's state to struct debug_obj. This will ensure we won't hit the code branch not belong to the static object.
For the same static object, debug_object_init may enter multiple times, but there is a lock in debug_object_init to ensure that there is no problem.
---
Changes from v1:
- Reduce debug object size as Waiman Long suggested.
- Add description for new members.
--- include/linux/debugobjects.h | 6 ++- lib/debugobjects.c | 71 ++++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 17 deletions(-)
include/linux/debugobjects.h +5 -1
@@ -21,13 +21,17 @@ struct debug_obj_descr;* struct debug_obj - representation of an tracked object * @node: hlist node to link the object into the tracker list * @state: tracked object state +* @is_state: flag used to indicate that it is a static object * @astate: current active state * @object: pointer to the real object * @descr: pointer to an object type specific debug description structure */ struct debug_obj {struct hlist_node node; -enum debug_obj_state state; +struct { +enum debug_obj_state state :31 ; +bool is_static :1 ; + };unsigned int astate;void *object;const struct debug_obj_descr *descr;
lib/debugobjects.c +55 -16
145 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 2/2 debugobject: add unit test for static debug object
Add test case to enusre that static debug object correctness.
Tested on little-endian arm64 qemu, result:
[ 2.385735] KTAP version 1 [ 2.385860] 1..1 [ 2.386406] KTAP version 1 [ 2.386658] # Subtest: static debugobject init [ 2.386726] 1..1 [ 2.401777] ok 1 static_debugobject_test [ 2.402455] ok 1 static debugobject init
--- MAINTAINERS | 5 ++ lib/Kconfig.debug | 14 ++++ lib/Makefile | 2 + lib/test_static_debug_object.c | 125 +++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+) create mode 100644 lib/test_static_debug_object.c
MAINTAINERS +5 -0
@@ -23202,6 +23202,11 @@ L: [email protected] S: Maintained F: mm/zswap.c +STATIC DEBUGOBJECT TEST +M: Schspa Shi <[email protected]> +S: Maintained +F: lib/test_static_debug_object.c + THE REST M: Linus Torvalds <[email protected]> L: [email protected]
lib/Kconfig.debug +14 -0
@@ -2801,6 +2801,20 @@ config TEST_CLOCKSOURCE_WATCHDOG If unsure, say N. +config TEST_STATIC_DEBUGOBJECT + tristate "KUnit test for static debugobject" + depends on KUNIT + select KPROBES + select DEBUG_OBJECTS + select DEBUG_OBJECTS_TIMERS + help + This builds the static debugobject unit test, which runs on boot. + Tests the static debug object correctness. + For more information on KUnit and unit tests in general please refer + to the KUnit documentation in Documentation/dev-tools/kunit/. + + If unsure, say N. + endif # RUNTIME_TESTING_MENU config ARCH_USE_MEMTEST
lib/Makefile +2 -0
@@ -427,3 +427,5 @@ $(obj)/$(TEST_FORTIFY_LOG): $(addprefix $(obj)/, $(TEST_FORTIFY_LOGS)) FORCE ifeq ($(CONFIG_FORTIFY_SOURCE),y) $(obj)/string.o: $(obj)/$(TEST_FORTIFY_LOG) endif + +obj-$(CONFIG_TEST_STATIC_DEBUGOBJECT) += test_static_debug_object.o
lib/test_static_debug_object.c new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
2.39.2
kernel test robot
build botRe: [PATCH v2 2/2] debugobject: add unit test for static debug object
I love your patch! Yet something to improve:
Hi Schspa,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.2 next-20230303]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Schspa-Shi/debugobject-add-unit-test-for-static-debug-object/20230304-024247 patch link: https://lore.kernel.org/r/20230303183147.934793-2-schspa%40gmail.com patch subject: [PATCH v2 2/2] debugobject: add unit test for static debug object config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230304/[email protected]/config) compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/54cf5a36c1c89cb79463e38bdbd636a016a80c66
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Schspa-Shi/debugobject-add-unit-test-for-static-debug-object/20230304-024247 git checkout 54cf5a36c1c89cb79463e38bdbd636a016a80c66
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
In file included from include/linux/kgdb.h:19,
from include/drm/drm_util.h:36,
from include/drm/drm_connector.h:32,
from include/drm/drm_modes.h:33,
from include/drm/drm_crtc.h:32,
from include/drm/drm_atomic_helper.h:31,
from drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c:8:
>> include/linux/kprobes.h:70:9: error: unknown type name 'kprobe_opcode_t'
70 | kprobe_opcode_t *addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:85:9: error: unknown type name 'kprobe_opcode_t'
85 | kprobe_opcode_t opcode;
| ^~~~~~~~~~~~~~~
>> include/linux/kprobes.h:88:35: error: field 'ainsn' has incomplete type
88 | struct arch_specific_insn ainsn;
| ^~~~~
include/linux/kprobes.h:174:9: error: unknown type name 'kprobe_opcode_t'
174 | kprobe_opcode_t *ret_addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:298:33: error: unknown type name 'kprobe_opcode_t'
298 | extern int kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7,
from arch/alpha/include/asm/percpu.h:17,
from include/linux/irqflags.h:17,
from include/linux/spinlock.h:59,
from include/drm/drm_crtc.h:28:
include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/percpu-defs.h:219:59: error: invalid use of undefined type 'struct kprobe_ctlblk'
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^
include/linux/percpu-defs.h:241:9: note: in expansion of macro '__verify_pcpu_ptr'
241 | __verify_pcpu_ptr(ptr); \
| ^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: in expansion of macro 'raw_cpu_ptr'
252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
| ^~~~~~~~~~~
include/linux/kprobes.h:414:16: note: in expansion of macro 'this_cpu_ptr'
414 | return this_cpu_ptr(&kprobe_ctlblk);
| ^~~~~~~~~~~~
include/linux/kprobes.h: At top level:
include/linux/kprobes.h:417:1: error: unknown type name 'kprobe_opcode_t'
417 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:418:1: error: unknown type name 'kprobe_opcode_t'
418 | kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offset, bool *on_func_entry);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h: In function 'kprobe_page_fault':
>> include/linux/kprobes.h:599:16: error: implicit declaration of function 'kprobe_fault_handler' [-Werror=implicit-function-declaration]
599 | return kprobe_fault_handler(regs, trap);
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from include/linux/vga_switcheroo.h:34,
from sound/pci/hda/hda_intel.c:52:
>> include/linux/kprobes.h:70:9: error: unknown type name 'kprobe_opcode_t'
70 | kprobe_opcode_t *addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:85:9: error: unknown type name 'kprobe_opcode_t'
85 | kprobe_opcode_t opcode;
| ^~~~~~~~~~~~~~~
>> include/linux/kprobes.h:88:35: error: field 'ainsn' has incomplete type
88 | struct arch_specific_insn ainsn;
| ^~~~~
include/linux/kprobes.h:174:9: error: unknown type name 'kprobe_opcode_t'
174 | kprobe_opcode_t *ret_addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:298:33: error: unknown type name 'kprobe_opcode_t'
298 | extern int kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7,
from arch/alpha/include/asm/percpu.h:17,
from include/linux/irqflags.h:17,
from include/linux/rcupdate.h:26,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/delay.h:23,
from sound/pci/hda/hda_intel.c:23:
include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/percpu-defs.h:219:59: error: invalid use of undefined type 'struct kprobe_ctlblk'
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^
include/linux/percpu-defs.h:241:9: note: in expansion of macro '__verify_pcpu_ptr'
241 | __verify_pcpu_ptr(ptr); \
| ^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: in expansion of macro 'raw_cpu_ptr'
252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
| ^~~~~~~~~~~
include/linux/kprobes.h:414:16: note: in expansion of macro 'this_cpu_ptr'
414 | return this_cpu_ptr(&kprobe_ctlblk);
| ^~~~~~~~~~~~
include/linux/kprobes.h: At top level:
include/linux/kprobes.h:417:1: error: unknown type name 'kprobe_opcode_t'
417 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:418:1: error: unknown type name 'kprobe_opcode_t'
418 | kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offset, bool *on_func_entry);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h: In function 'kprobe_page_fault':
>> include/linux/kprobes.h:599:16: error: implicit declaration of function 'kprobe_fault_handler' [-Werror=implicit-function-declaration]
599 | return kprobe_fault_handler(regs, trap);
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/init.h:5,
from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/alpha/include/asm/bug.h:23,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/alpha/include/generated/asm/current.h:1,
from include/linux/sched.h:12:
sound/pci/hda/hda_intel.c: At top level:
include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/compiler.h:232:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
232 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:55:59: note: in expansion of macro '__must_be_array'
55 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:517:20: note: in expansion of macro 'ARRAY_SIZE'
517 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:501:9: note: in expansion of macro 'module_param_array_named'
501 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/hda/hda_intel.c:125:1: note: in expansion of macro 'module_param_array'
125 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/hda/hda_intel.c:104:12: warning: 'index' defined but not used [-Wunused-variable]
104 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
| ^~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/kgdb.h:19,
from include/drm/drm_util.h:36,
from include/drm/drm_connector.h:32,
from include/drm/drm_modes.h:33,
from include/drm/drm_crtc.h:32,
from include/drm/drm_atomic.h:31,
from drivers/gpu/drm/arm/malidp_planes.c:12:
>> include/linux/kprobes.h:70:9: error: unknown type name 'kprobe_opcode_t'
70 | kprobe_opcode_t *addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:85:9: error: unknown type name 'kprobe_opcode_t'
85 | kprobe_opcode_t opcode;
| ^~~~~~~~~~~~~~~
>> include/linux/kprobes.h:88:35: error: field 'ainsn' has incomplete type
88 | struct arch_specific_insn ainsn;
| ^~~~~
include/linux/kprobes.h:174:9: error: unknown type name 'kprobe_opcode_t'
174 | kprobe_opcode_t *ret_addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:298:33: error: unknown type name 'kprobe_opcode_t'
298 | extern int kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7,
from arch/alpha/include/asm/percpu.h:17,
from include/linux/irqflags.h:17,
from include/linux/spinlock.h:59,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from include/linux/scatterlist.h:8,
from include/linux/iommu.h:10,
from drivers/gpu/drm/arm/malidp_planes.c:9:
include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/percpu-defs.h:219:59: error: invalid use of undefined type 'struct kprobe_ctlblk'
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^
include/linux/percpu-defs.h:241:9: note: in expansion of macro '__verify_pcpu_ptr'
241 | __verify_pcpu_ptr(ptr); \
| ^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: in expansion of macro 'raw_cpu_ptr'
252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
| ^~~~~~~~~~~
include/linux/kprobes.h:414:16: note: in expansion of macro 'this_cpu_ptr'
414 | return this_cpu_ptr(&kprobe_ctlblk);
| ^~~~~~~~~~~~
include/linux/kprobes.h: At top level:
include/linux/kprobes.h:417:1: error: unknown type name 'kprobe_opcode_t'
417 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:418:1: error: unknown type name 'kprobe_opcode_t'
418 | kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offset, bool *on_func_entry);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h: In function 'kprobe_page_fault':
include/linux/kprobes.h:599:16: error: implicit declaration of function 'kprobe_fault_handler'; did you mean 'iommu_set_fault_handler'? [-Werror=implicit-function-declaration]
599 | return kprobe_fault_handler(regs, trap);
| ^~~~~~~~~~~~~~~~~~~~
| iommu_set_fault_handler
cc1: some warnings being treated as errors
--
In file included from include/linux/kgdb.h:19,
from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from drivers/gpu/drm/amd/amdgpu/si_dma.c:25:
>> include/linux/kprobes.h:70:9: error: unknown type name 'kprobe_opcode_t'
70 | kprobe_opcode_t *addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:85:9: error: unknown type name 'kprobe_opcode_t'
85 | kprobe_opcode_t opcode;
| ^~~~~~~~~~~~~~~
>> include/linux/kprobes.h:88:35: error: field 'ainsn' has incomplete type
88 | struct arch_specific_insn ainsn;
| ^~~~~
include/linux/kprobes.h:174:9: error: unknown type name 'kprobe_opcode_t'
174 | kprobe_opcode_t *ret_addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:298:33: error: unknown type name 'kprobe_opcode_t'
298 | extern int kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7,
from arch/alpha/include/asm/percpu.h:17,
from include/linux/irqflags.h:17,
from include/linux/spinlock.h:59,
from include/linux/wait.h:9,
from include/linux/dma-fence.h:17,
from include/drm/gpu_scheduler.h:28,
from drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h:28,
from drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h:29,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:43:
include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/percpu-defs.h:219:59: error: invalid use of undefined type 'struct kprobe_ctlblk'
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^
include/linux/percpu-defs.h:241:9: note: in expansion of macro '__verify_pcpu_ptr'
241 | __verify_pcpu_ptr(ptr); \
| ^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: in expansion of macro 'raw_cpu_ptr'
252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
| ^~~~~~~~~~~
include/linux/kprobes.h:414:16: note: in expansion of macro 'this_cpu_ptr'
414 | return this_cpu_ptr(&kprobe_ctlblk);
| ^~~~~~~~~~~~
include/linux/kprobes.h: At top level:
include/linux/kprobes.h:417:1: error: unknown type name 'kprobe_opcode_t'
417 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:418:1: error: unknown type name 'kprobe_opcode_t'
418 | kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offset, bool *on_func_entry);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h: In function 'kprobe_page_fault':
>> include/linux/kprobes.h:599:16: error: implicit declaration of function 'kprobe_fault_handler' [-Werror=implicit-function-declaration]
599 | return kprobe_fault_handler(regs, trap);
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:37,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h: At top level:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=]
53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/kgdb.h:19,
from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_opp.c:26:
>> include/linux/kprobes.h:70:9: error: unknown type name 'kprobe_opcode_t'
70 | kprobe_opcode_t *addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:85:9: error: unknown type name 'kprobe_opcode_t'
85 | kprobe_opcode_t opcode;
| ^~~~~~~~~~~~~~~
>> include/linux/kprobes.h:88:35: error: field 'ainsn' has incomplete type
88 | struct arch_specific_insn ainsn;
| ^~~~~
include/linux/kprobes.h:174:9: error: unknown type name 'kprobe_opcode_t'
174 | kprobe_opcode_t *ret_addr;
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:298:33: error: unknown type name 'kprobe_opcode_t'
298 | extern int kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
| ^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7,
from arch/alpha/include/asm/percpu.h:17,
from include/linux/irqflags.h:17,
from include/linux/spinlock.h:59,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/slab.h:15,
from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:30:
include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/percpu-defs.h:219:59: error: invalid use of undefined type 'struct kprobe_ctlblk'
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^
include/linux/percpu-defs.h:241:9: note: in expansion of macro '__verify_pcpu_ptr'
241 | __verify_pcpu_ptr(ptr); \
| ^~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:252:27: note: in expansion of macro 'raw_cpu_ptr'
252 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
| ^~~~~~~~~~~
include/linux/kprobes.h:414:16: note: in expansion of macro 'this_cpu_ptr'
414 | return this_cpu_ptr(&kprobe_ctlblk);
| ^~~~~~~~~~~~
include/linux/kprobes.h: At top level:
include/linux/kprobes.h:417:1: error: unknown type name 'kprobe_opcode_t'
417 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h:418:1: error: unknown type name 'kprobe_opcode_t'
418 | kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offset, bool *on_func_entry);
| ^~~~~~~~~~~~~~~
include/linux/kprobes.h: In function 'kprobe_page_fault':
>> include/linux/kprobes.h:599:16: error: implicit declaration of function 'kprobe_fault_handler' [-Werror=implicit-function-declaration]
599 | return kprobe_fault_handler(regs, trap);
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_opp.h:30,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_opp.c:29:
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h: At top level:
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:143:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
143 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:140:22: warning: 'DP_VGA_LVDS_CONVERTER_ID_3' defined but not used [-Wunused-const-variable=]
140 | static const uint8_t DP_VGA_LVDS_CONVERTER_ID_3[] = "dnomlA";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:138:22: warning: 'DP_VGA_LVDS_CONVERTER_ID_2' defined but not used [-Wunused-const-variable=]
138 | static const uint8_t DP_VGA_LVDS_CONVERTER_ID_2[] = "sivarT";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:135:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
135 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:133:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
133 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5};
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
132 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3};
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:37,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=]
53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors
..
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for KPROBES Depends on [n]: MODULES [=y] && HAVE_KPROBES [=n]
Selected by [y]:
- TEST_STATIC_DEBUGOBJECT [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]
vim +/kprobe_opcode_t +70 include/linux/kprobes.h
d0aaff9796c331 Prasanna S Panchamukhi 2005-09-06 49
^1da177e4c3f41 Linus Torvalds 2005-04-16 50 struct kprobe;
^1da177e4c3f41 Linus Torvalds 2005-04-16 51 struct pt_regs;
b94cce926b2b90 Hien Nguyen 2005-06-23 52 struct kretprobe;
b94cce926b2b90 Hien Nguyen 2005-06-23 53 struct kretprobe_instance;
^1da177e4c3f41 Linus Torvalds 2005-04-16 54 typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *);
^1da177e4c3f41 Linus Torvalds 2005-04-16 55 typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *,
^1da177e4c3f41 Linus Torvalds 2005-04-16 56 unsigned long flags);
b94cce926b2b90 Hien Nguyen 2005-06-23 57 typedef int (*kretprobe_handler_t) (struct kretprobe_instance *,
b94cce926b2b90 Hien Nguyen 2005-06-23 58 struct pt_regs *);
b94cce926b2b90 Hien Nguyen 2005-06-23 59
^1da177e4c3f41 Linus Torvalds 2005-04-16 60 struct kprobe {
^1da177e4c3f41 Linus Torvalds 2005-04-16 61 struct hlist_node hlist;
^1da177e4c3f41 Linus Torvalds 2005-04-16 62
64f562c6df3cfc Ananth N Mavinakayanahalli 2005-05-05 63 /* list of kprobes for multi-handler support */
64f562c6df3cfc Ananth N Mavinakayanahalli 2005-05-05 64 struct list_head list;
64f562c6df3cfc Ananth N Mavinakayanahalli 2005-05-05 65
ea32c65cc2d229 Prasanna S Panchamukhi 2005-06-23 66 /*count the number of times this probe was temporarily disarmed */
ea32c65cc2d229 Prasanna S Panchamukhi 2005-06-23 67 unsigned long nmissed;
ea32c65cc2d229 Prasanna S Panchamukhi 2005-06-23 68
^1da177e4c3f41 Linus Torvalds 2005-04-16 69 /* location of the probe point */
^1da177e4c3f41 Linus Torvalds 2005-04-16 @70 kprobe_opcode_t *addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 71
3a872d89baae82 Ananth N Mavinakayanahalli 2006-10-02 72 /* Allow user to indicate symbol name of the probe point */
9b3af29bf33bfe Ananth N Mavinakayanahalli 2007-05-08 73 const char *symbol_name;
3a872d89baae82 Ananth N Mavinakayanahalli 2006-10-02 74
3a872d89baae82 Ananth N Mavinakayanahalli 2006-10-02 75 /* Offset into the symbol */
3a872d89baae82 Ananth N Mavinakayanahalli 2006-10-02 76 unsigned int offset;
3a872d89baae82 Ananth N Mavinakayanahalli 2006-10-02 77
^1da177e4c3f41 Linus Torvalds 2005-04-16 78 /* Called before addr is executed. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 79 kprobe_pre_handler_t pre_handler;
^1da177e4c3f41 Linus Torvalds 2005-04-16 80
^1da177e4c3f41 Linus Torvalds 2005-04-16 81 /* Called after addr is executed, unless... */
^1da177e4c3f41 Linus Torvalds 2005-04-16 82 kprobe_post_handler_t post_handler;
^1da177e4c3f41 Linus Torvalds 2005-04-16 83
^1da177e4c3f41 Linus Torvalds 2005-04-16 84 /* Saved opcode (which has been replaced with breakpoint) */
^1da177e4c3f41 Linus Torvalds 2005-04-16 85 kprobe_opcode_t opcode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 86
^1da177e4c3f41 Linus Torvalds 2005-04-16 87 /* copy of the original instruction */
^1da177e4c3f41 Linus Torvalds 2005-04-16 @88 struct arch_specific_insn ainsn;
e8386a0cb22f4a Masami Hiramatsu 2009-01-06 89
de5bd88d5a5cce Masami Hiramatsu 2009-04-06 90 /*
de5bd88d5a5cce Masami Hiramatsu 2009-04-06 91 * Indicates various status flags.
de5bd88d5a5cce Masami Hiramatsu 2009-04-06 92 * Protected by kprobe_mutex after this kprobe is registered.
de5bd88d5a5cce Masami Hiramatsu 2009-04-06 93 */
e8386a0cb22f4a Masami Hiramatsu 2009-01-06 94 u32 flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 95 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 96 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [PATCH v2 2/2] debugobject: add unit test for static debug object
In reply to Schspa ShiI love your patch! Yet something to improve:
Hi Schspa,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.2 next-20230303]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Schspa-Shi/debugobject-add-unit-test-for-static-debug-object/20230304-024247 patch link: https://lore.kernel.org/r/20230303183147.934793-2-schspa%40gmail.com patch subject: [PATCH v2 2/2] debugobject: add unit test for static debug object config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20230304/[email protected]/config) compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/54cf5a36c1c89cb79463e38bdbd636a016a80c66
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Schspa-Shi/debugobject-add-unit-test-for-static-debug-object/20230304-024247 git checkout 54cf5a36c1c89cb79463e38bdbd636a016a80c66
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "regs_get_register" [lib/test_static_debug_object.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/idma64.ko] undefined!
ERROR: modpost: "iounmap" [drivers/tty/ipwireless/ipwireless.ko] undefined!
ERROR: modpost: "ioremap" [drivers/tty/ipwireless/ipwireless.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/char/xillybus/xillybus_of.ko] undefined!
ERROR: modpost: "devm_memremap" [drivers/misc/open-dice.ko] undefined!
ERROR: modpost: "devm_memunmap" [drivers/misc/open-dice.ko] undefined!
ERROR: modpost: "iounmap" [drivers/net/ethernet/8390/pcnet_cs.ko] undefined!
WARNING: modpost: suppressed 16 unresolved symbol warnings because there were too many)
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests