/* * test_kprobes.c - simple sanity test for *probes * * Copyright IBM Corp. 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. */ #define pr_fmt(fmt) "Kprobe smoke test: " fmt #include #include #include #define div_factor 3 static u32 rand1, preh_val, posth_val, jph_val; static int errors, handler_errors, num_tests; static u32 (*target)(u32 value); static u32 (*target2)(u32 value); static noinline u32 kprobe_target(u32 value) { return (value / div_factor); } static int kp_pre_handler(struct kprobe *p, struct pt_regs *regs) { preh_val = (rand1 / div_factor); return 0; } static void kp_post_handler(struct kprobe *p, struct pt_regs *regs, unsigned long flags) { if (preh_val != (rand1 / div_factor)) { handler_errors++; pr_err("incorrect value in post_handler\n"); } posth_val = preh_val + div_factor; } static struct kprobe kp = { .symbol_name = "kprobe_target", .pre_handler = kp_pre_handler, .post_handler = kp_post_handler }; static int test_kprobe(void) { int ret; ret = register_kprobe(&kp); if (ret < 0) { pr_err("register_kprobe returned %d\n", ret); return ret; } ret = target(rand1); unregister_kprobe(&kp); if (preh_val == 0) { pr_err("kprobe pre_handler not called\n"); handler_errors++; } if (posth_val == 0) { pr_err("kprobe post_handler not called\n"); handler_errors++; } return 0; } static noinline u32 kprobe_target2(u32 value) { return (value / div_factor) + 1; } static int kp_pre_handler2(struct kprobe *p, struct pt_regs *regs) { preh_val = (rand1 / div_factor) + 1; return 0; } static void kp_post_handler2(struct kprobe *p, struct pt_regs *regs, unsigned long flags) { if (preh_val != (rand1 / div_factor) + 1) { handler_errors++; pr_err("incorrect value in post_handler2\n"); } posth_val = preh_val + div_factor; } static struct kprobe kp2 = { .symbol_name = "kprobe_target2", .pre_handler = kp_pre_handler2, .post_handler = kp_post_handler2 }; static int test_kprobes(void) { int ret; struct kprobe *kps[2] = {&kp, &kp2}; /* addr and flags should be cleard for reusing kprobe. */ kp.addr = NULL; kp.flags = 0; ret = register_kprobes(kps, 2); if (ret < 0) { pr_err("register_kprobes returned %d\n", ret); return ret; } preh_val = 0; posth_val = 0; ret = target(rand1); if (preh_val == 0) { pr_err("kprobe pre_handler not called\n"); handler_errors++; } if (posth_val == 0) { pr_err("kprobe post_handler not called\n"); handler_errors++; } preh_val = 0; posth_val = 0; ret = target2(rand1); if (preh_val == 0) { pr_err("kprobe pre_handler2 not called\n"); handler_errors++; } if (posth_val == 0) { pr_err("kprobe post_handler2 not called\n"); handler_errors++; } unregister_kprobes(kps, 2); return 0; } static u32 j_kprobe_target(u32 value) { if (value != rand1) { handler_errors++; pr_err("incorrect value in jprobe handler\n"); } jph_val = rand1; jprobe_return(); return 0; } static struct jprobe jp = { .entry = j_kprobe_target, .kp.symbol_name = "kprobe_target" }; static int test_jprobe(void) { int ret; ret = register_jprobe(&jp); if (ret < 0) { pr_err("register_jprobe returned %d\n", ret); return ret; } ret = target(rand1); unregister_jprobe(&jp); if (jph_val == 0) { pr_err("jprobe handler not called\n"); handler_errors++; } return 0; } static struct jprobe jp2 = { .entry = j_kprobe_target, .kp.symbol_name = "kprobe_target2" }; static int test_jprobes(void) { int ret; struct jprobe *jps[2] = {&jp, &jp2}; /* addr and flags should be cleard for reusing kprobe. */ jp.kp.addr = NULL; jp.kp.flags = 0; ret = register_jprobes(jps, 2); if (ret < 0) { pr_err("register_jprobes returned %d\n", ret); return ret; } jph_val = 0; ret = target(rand1); if (jph_val == 0) { pr_err("jprobe handler not called\n"); handler_errors++; } jph_val = 0; ret = target2(rand1); if (jph_val == 0) { pr_err("jprobe handler2 not called\n"); handler_errors++; } unregister_jprobes(jps, 2); return 0; } #ifdef CONFIG_KRETPROBES static u32 krph_val; static int entry_handler(struct kretprobe_instance *ri, struct pt_regs *regs) { krph_val = (rand1 / div_factor); return 0; } static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs) { unsigned long ret = regs_return_value(regs); if (ret != (rand1 / div_factor)) { handler_errors++; pr_err("incorrect value in kretprobe handler\n"); } if (krph_val == 0) { handler_errors++; pr_err("call to kretprobe entry handler failed\n"); } krph_val = rand1; return 0; } static struct kretprobe rp = { .handler = return_handler, .entry_handler = entry_handler, .kp.symbol_name = "kprobe_target" }; static int test_kretprobe(void) { int ret; ret = register_kretprobe(&rp); if (ret < 0) { pr_err("register_kretprobe returned %d\n", ret); return ret; } ret = target(rand1); unregister_kretprobe(&rp); if (krph_val != rand1) { pr_err("kretprobe handler not called\n"); handler_errors++; } return 0; } static int return_handler2(struct kretprobe_instance *ri, struct pt_regs *regs) { unsigned long ret = regs_return_value(regs); if (ret != (rand1 / div_factor) + 1) { handler_errors++; pr_err("incorrect value in kretprobe handler2\n"); } if (krph_val == 0) { handler_errors++; pr_err("call to kretprobe entry handler failed\n"); } krph_val = rand1; return 0; } static struct kretprobe rp2 = { .handler = return_handler2, .entry_handler = entry_handler, .kp.symbol_name = "kprobe_target2" }; static int test_kretprobes(void) { int ret; struct kretprobe *rps[2] = {&rp, &rp2}; /* addr and flags should be cleard for reusing kprobe. */ rp.kp.addr = NULL; rp.kp.flags = 0; ret = register_kretprobes(rps, 2); if (ret < 0) { pr_err("register_kretprobe returned %d\n", ret); return ret; } krph_val = 0; ret = target(rand1); if (krph_val != rand1) { pr_err("kretprobe handler not called\n"); handler_errors++; } krph_val = 0; ret = target2(rand1); if (krph_val != rand1) { pr_err("kretprobe handler2 not called\n"); handler_errors++; } unregister_kretprobes(rps, 2); return 0; } #endif /* CONFIG_KRETPROBES */ int init_test_probes(void) { int ret; target = kprobe_target; target2 = kprobe_target2; do { rand1 = prandom_u32(); } while (rand1 <= div_factor); pr_info("started\n"); num_tests++; ret = test_kprobe(); if (ret < 0) errors++; num_tests++; ret = test_kprobes(); if (ret < 0) errors++; num_tests++; ret = test_jprobe(); if (ret < 0) errors++; num_tests++; ret = test_jprobes(); if (ret < 0) errors++; #ifdef CONFIG_KRETPROBES num_tests++; ret = test_kretprobe(); if (ret < 0) errors++; num_tests++; ret = test_kretprobes(); if (ret < 0) errors++; #endif /* CONFIG_KRETPROBES */ if (errors) pr_err("BUG: %d out of %d tests failed\n", errors, num_tests); else if (handler_errors) pr_err("BUG: %d error(s) running handlers\n", handler_errors); else pr_info("passed successfully\n"); return 0; } 285/0x2f0 [drm_kms_helper] age=0 cpu=3 pid=1529 ___slab_alloc+0x308/0x3b0 __slab_alloc+0xd/0x20 kmem_cache_alloc_trace+0x92/0x1c0 drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] intel_atomic_commit+0x35/0x4f0 [i915] drm_atomic_commit+0x46/0x50 [drm] drm_mode_atomic_ioctl+0x7d4/0xab0 [drm] drm_ioctl+0x2b3/0x490 [drm] do_vfs_ioctl+0x69c/0x700 SyS_ioctl+0x4e/0x80 entry_SYSCALL_64_fastpath+0x13/0x94 INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529 __slab_free+0x48/0x2e0 kfree+0x159/0x1a0 drm_event_cancel_free+0xa3/0xb0 [drm] drm_mode_atomic_ioctl+0x86d/0xab0 [drm] drm_ioctl+0x2b3/0x490 [drm] do_vfs_ioctl+0x69c/0x700 SyS_ioctl+0x4e/0x80 entry_SYSCALL_64_fastpath+0x13/0x94 INFO: Slab 0xffffde1f0997b080 objects=17 used=2 fp=0xffff92fb65ec2578 flags=0x200000000008101 INFO: Object 0xffff92fb65ec2578 @offset=1400 fp=0xffff92fb65ec2ae8 Redzone ffff92fb65ec2570: bb bb bb bb bb bb bb bb ........ Object ffff92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk. Redzone ffff92fb65ec25f8: bb bb bb bb bb bb bb bb ........ Padding ffff92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: G BU 4.10.0-rc6-patser+ #5039 Hardware name: /NUC5PPYB, BIOS PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015 Workqueue: events intel_atomic_helper_free_state [i915] Call Trace: dump_stack+0x4d/0x6d print_trailer+0x20c/0x220 free_debug_processing+0x1c6/0x330 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm] __slab_free+0x48/0x2e0 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm] kfree+0x159/0x1a0 drm_atomic_state_default_clear+0xf7/0x1c0 [drm] ? drm_atomic_state_clear+0x30/0x30 [drm] intel_atomic_state_clear+0xd/0x20 [i915] drm_atomic_state_clear+0x1a/0x30 [drm] __drm_atomic_state_free+0x13/0x60 [drm] intel_atomic_helper_free_state+0x5d/0x70 [i915] process_one_work+0x260/0x4a0 worker_thread+0x2d1/0x4f0 kthread+0x127/0x130 ? process_one_work+0x4a0/0x4a0 ? kthread_stop+0x120/0x120 ret_from_fork+0x29/0x40 FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed Fixes: 3b24f7d67581 ("drm/atomic: Add struct drm_crtc_commit to track async updates") Fixes: 9626014258a5 ("drm/fence: add in-fences support") Cc: <stable@vger.kernel.org> # v4.8+ Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
Diffstat (limited to 'include/dt-bindings/reset/qcom,gcc-apq8084.h')