serial debug: permission denied

carrollbryanm at gmail.com carrollbryanm at gmail.com
Sat Apr 27 19:19:54 EDT 2024


Hi all,

 

I'm attempting to use gdb to debug over a serial connection using two VM's.
I'm getting a "Permission denied" when I try to connect over the serial com
port. Gdb has the following output when I try to connect: 

 

Reading symbols from vmlinux...

+target remote /dev/ttyS1

Remote debugging using /dev/ttyS1

[remote] start_remote_1: enter

  [remote] Sending packet:
$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-e
vents+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-taggin
g+#ec

  [remote] Junk: d

  [remote] Junk: i

  [remote] Junk: a

  [remote] Junk: g

  [remote] Junk: :

  [remote] Junk:

  [remote] Received Nak

  [remote] Sending packet:
$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-e
vents+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-taggin
g+#ec

  [remote] Junk: 2

  [remote] Junk: 2

  [remote] Junk: :

  [remote] Junk:

  [remote] Junk: P

  [remote] Junk: e

  [remote] Junk: r

  [remote] Junk: m

  [remote] Junk: i

  [remote] Junk: s

  [remote] Junk: s

  [remote] Junk: i

  [remote] Junk: o

  [remote] Junk: n

  [remote] Junk:

  [remote] Junk: d

  [remote] Junk: e

  [remote] Junk: n

  [remote] Junk: i

  [remote] Junk: e

  [remote] Junk: d

  [remote] Junk: ^M

  [remote] Junk:

 

  [remote] Junk: [

  [remote] Junk: 2

  [remote] Junk: ]

  [remote] Junk: k

  [remote] Junk: d

  [remote] Junk: b

  [remote] Junk: >

  [remote] Junk:

  [remote] Junk: :

  [remote] Junk: m

  [remote] Junk: u

  [remote] Junk: l

  [remote] Junk: t

  [remote] Junk: i

  [remote] Junk: p

  [remote] Junk: r

  [remote] Junk: o

  [remote] Junk: c

  [remote] Junk: e

  [remote] Junk: s

  [remote] Junk: s

  [remote] Received Ack

  [remote] read_frame: Bad checksum, sentsum=0xec, csum=0x8,
buf=qSupporteddiag: -22: Permission denied\r\n[2]kdb>
:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec
-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+

  [remote] getpkt: Timed out.

  [remote] getpkt: Timed out.

Ignoring packet error, continuing...

  [remote] packet_ok: Packet qSupported (supported-packets) is supported

  [remote] Sending packet: $vCont?#49

  [remote] Received Nak

  [remote] Sending packet: $vCont?#49

  [remote] Received Ack

  [remote] Packet received: vCont?

  [remote] packet_ok: Packet vCont (verbose-resume) is NOT supported

  [remote] packet_ok: Packet vCont (verbose-resume) is NOT supported

  [remote] Sending packet: $vMustReplyEmpty#3a

  [remote] putpkt_binary: Packet instead of Ack, ignoring it

  [remote] Received Ack

  [remote] Packet received: vMustReplyEmpty

[remote] start_remote_1: exit

Remote replied unexpectedly to 'vMustReplyEmpty': vMustReplyEmpty

+quit

 

It seems the target is denying permission. I've been searching around but
have not found anything similar. I tried opening the permissions on the
/dev/ttyS1 on both VM's to rwxrwxrwx and that doesn't help. There are no
SELinux warnings on the debugger VM. I don't know if SELinux is causing a
problem on the target VM.

 

More details about the configuration:

 

I'm running two Rocky 9.3 VM's on Windows Hyper-V that I have connected over
a named pipe using the Powershell Set-VMComport commands:

 

Set-VMComport -VMName "Rocky-Debugger" -Number 2 -Path \\.\pipe\rocky-pipe-2
<file://./pipe/rocky-pipe-2> 

Set-VMComport -VMName "Rocky " -Number 2 -Path \\.\pipe\rocky-pipe-2
<file://./pipe/rocky-pipe-2> 

 

I downloaded the 6.8.5 kernel from the kernel.org website and compiled it on
the "Rocky" vm using the following configuration:

 

#

# Generic Kernel Debugging Instruments

#

CONFIG_MAGIC_SYSRQ=y

CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1

CONFIG_MAGIC_SYSRQ_SERIAL=y

CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE=""

CONFIG_DEBUG_FS=y

CONFIG_DEBUG_FS_ALLOW_ALL=y

# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set

# CONFIG_DEBUG_FS_ALLOW_NONE is not set

CONFIG_HAVE_ARCH_KGDB=y

CONFIG_KGDB=y

CONFIG_KGDB_HONOUR_BLOCKLIST=y

CONFIG_KGDB_SERIAL_CONSOLE=y

CONFIG_KGDB_TESTS=y

# CONFIG_KGDB_TESTS_ON_BOOT is not set

CONFIG_KGDB_LOW_LEVEL_TRAP=y

CONFIG_KGDB_KDB=y

CONFIG_KDB_DEFAULT_ENABLE=0x0

CONFIG_KDB_KEYBOARD=y

CONFIG_KDB_CONTINUE_CATASTROPHIC=0

CONFIG_ARCH_HAS_EARLY_DEBUG=y

CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y

# CONFIG_UBSAN is not set

CONFIG_HAVE_ARCH_KCSAN=y

CONFIG_HAVE_KCSAN_COMPILER=y

# CONFIG_KCSAN is not set

# end of Generic Kernel Debugging Instruments

 

I added the kernel args "console=tty0 console=ttyS0,115200
kgdboc=ttyS1,115200". I start the VM with the new kernel and run the command
"echo g > /proc/sysrq-trigger".

 

On the "Rocky-debugger" vm, I added my user to "dialout". The permissions on
/dev/ttyS1 is rw for the group.

 

I set the following in .gdbinit, "set serial baud 115200".

 

Run "gdb vmlinux", then "target remote /dev/ttyS1". That's when I get the
"Permission denied". 

 

I can connect to the console over serial using "sudo screen ttyS0" and that
works just fine. So I don't believe it's a Windows Hyper-V permissions
issue.

 

I'm out of ideas. Any help is appreciated!

 

Thanks,

Bryan Carroll

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20240427/f0d52429/attachment.html>


More information about the Kernelnewbies mailing list