From: Mick Davis <mickd@goanna.iinet.net.au>
To: gdb-patches@sourceware.org
Subject: gdbserver corrupts binary data in remote protocol
Date: Thu, 06 Dec 2007 14:22:00 -0000 [thread overview]
Message-ID: <475801C5.2090809@goanna.iinet.net.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
I believe I've found a small bug when using the gdbserver to write into
target memory.
If the command received by the server uses a binary encoded data part,
the remote protocol will clear the most significant bit of each byte.
This may result in a CRC failure. The fix is to the readchar function,
which applies a bit mask to the returned byte.
Thanks
--
Mick Davis
Goanna Technologies Pty Ltd
ChangeLog entry:
2007-12-06 Mick Davis <mickd@goanna.iinet.net.au>
* gdbserver/remote-utils.c (readchar): Allow binary data in received
messages
[-- Attachment #2: remote_binary_packet_fix.diff --]
[-- Type: text/x-patch, Size: 675 bytes --]
Index: src/gdb/gdbserver/remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.50
diff -c -p -r1.50 remote-utils.c
*** src/gdb/gdbserver/remote-utils.c 23 Aug 2007 18:08:48 -0000 1.50
--- src/gdb/gdbserver/remote-utils.c 6 Dec 2007 13:23:05 -0000
*************** readchar (void)
*** 722,728 ****
bufp = buf;
bufcnt--;
! return *bufp++ & 0x7f;
}
/* Read a packet from the remote machine, with error checking,
--- 722,728 ----
bufp = buf;
bufcnt--;
! return *bufp++;
}
/* Read a packet from the remote machine, with error checking,
next reply other threads:[~2007-12-06 14:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 14:22 Mick Davis [this message]
2007-12-06 16:27 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=475801C5.2090809@goanna.iinet.net.au \
--to=mickd@goanna.iinet.net.au \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox