https://bugs.kde.org/show_bug.cgi?id=505673

--- Comment #12 from Paul Floyd <[email protected]> ---
This isn't specific to your minishell. I can reproduce a similar crash with the
Korn shell, like this

> ./vg-in-place ./ksh
==3492562== Memcheck, a memory error detector
==3492562== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==3492562== Using Valgrind-3.26.0.GIT and LibVEX; rerun with -h for copyright
info
==3492562== Command: ./ksh
==3492562== 
$ echo foo > ./ksh
--3492562-- VALGRIND INTERNAL ERROR: Valgrind received a signal 7 (SIGBUS) -
exiting
--3492562-- si_code=2;  Faulting address: 0x4031DE3;  sp: 0x1002ece5d0

valgrind: the 'impossible' happened:
   Killed by fatal signal

host stacktrace:
==3492562==    at 0x581DD1C5: disInstr_AMD64_WRK (guest_amd64_toIR.c:32279)
==3492562==    by 0x581DE2BD: disInstr_AMD64 (guest_amd64_toIR.c:32687)
==3492562==    by 0x5816A0C1: disassemble_basic_block_till_stop.constprop.0
(guest_generic_bb_to_IR.c:956)
==3492562==    by 0x5816A827: bb_to_IR (guest_generic_bb_to_IR.c:1365)
==3492562==    by 0x5814ECE0: LibVEX_FrontEnd (main_main.c:611)
==3492562==    by 0x5814F62A: LibVEX_Translate (main_main.c:1287)
==3492562==    by 0x5805B2B5: vgPlain_translate (m_translate.c:1835)
==3492562==    by 0x58098EBB: handle_chain_me (scheduler.c:1172)
==3492562==    by 0x5809B3C3: vgPlain_scheduler (scheduler.c:1568)
==3492562==    by 0x58104B3A: thread_wrapper (syswrap-linux.c:102)
==3492562==    by 0x58104B3A: run_a_thread_NORETURN (syswrap-linux.c:155)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 3492562)
==3492562==    at 0x4031DE3: ??? (in /home/paulf/scratch/valgrind/ksh)
==3492562==    by 0x4034A2C: ??? (in /home/paulf/scratch/valgrind/ksh)
==3492562==    by 0x406D02C: ??? (in /home/paulf/scratch/valgrind/ksh)
==3492562==    by 0x40146C6: ??? (in /home/paulf/scratch/valgrind/ksh)
==3492562==    by 0x4014FBB: ??? (in /home/paulf/scratch/valgrind/ksh)
==3492562==    by 0x55787E4: (below main) (in /usr/lib64/libc-2.28.so)
client stack range: [0x1FFEFF7000 0x1FFF000FFF] client SP: 0x1FFEFFE890
valgrind stack range: [0x1002DCF000 0x1002ECEFFF] top usage: 14456 of 1048576

We should probably be rejecting the attempt to open the guest exe.

If I run just ksh and do the same thing

echo foo > ./ksh
./ksh: ./ksh: cannot create [Text file busy]

In strace the rejected syscall is

openat(AT_FDCWD, "./ksh", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ETXTBSY (Text
file busy)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to