Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valgrind can't be used on LKL_HIJACK_NET_TAP runs #68

Open
pscollins opened this issue Feb 8, 2016 · 0 comments
Open

Valgrind can't be used on LKL_HIJACK_NET_TAP runs #68

pscollins opened this issue Feb 8, 2016 · 0 comments

Comments

@pscollins
Copy link
Member

Valgrind runs code in LD_PRELOAD twice for any process it is used on, so it can't be used as-is for checking memory access in hijacked executables that need to use TAP devices. The first execution starts up the LKL kernel and takes control of the TAP device, and then the second execution errors out because the device is already in use.

As a heads up to anyone else trying to track down memory errors, I patched Valgrind to support using LKL_PRELOAD and LKL_LIBRARY_PATH as replacements for LD_* versions. The repo is here --- let me know if there's anything I should do with that repo to make it more useful to LKL. I changed the Linux launcher in particular so no other platforms are supported.

thehajime pushed a commit to thehajime/linux that referenced this issue Aug 5, 2022
…tible()

Using wait_event_interruptible() to wait for complete transmission,
but do not check the result of wait_event_interruptible() which can be
interrupted. It will result in TX buffer has multiple accessors and
the later process interferes with the previous process.

Following is one of the problems reported by syzbot.

=============================================================
WARNING: CPU: 0 PID: 0 at net/can/isotp.c:840 isotp_tx_timer_handler+0x2e0/0x4c0
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.13.0-rc7+ lkl#68
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
RIP: 0010:isotp_tx_timer_handler+0x2e0/0x4c0
Call Trace:
 <IRQ>
 ? isotp_setsockopt+0x390/0x390
 __hrtimer_run_queues+0xb8/0x610
 hrtimer_run_softirq+0x91/0xd0
 ? rcu_read_lock_sched_held+0x4d/0x80
 __do_softirq+0xe8/0x553
 irq_exit_rcu+0xf8/0x100
 sysvec_apic_timer_interrupt+0x9e/0xc0
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20

Add result check for wait_event_interruptible() in isotp_sendmsg()
to avoid multiple accessers for tx buffer.

Fixes: e057dd3 ("can: add ISO 15765-2:2016 transport protocol")
Link: https://lore.kernel.org/all/10ca695732c9dd267c76a3c30f37aefe1ff7e32f.1633764159.git.william.xuanziyang@huawei.com
Cc: [email protected]
Reported-by: [email protected]
Signed-off-by: Ziyang Xuan <[email protected]>
Acked-by: Oliver Hartkopp <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant