| Summary: | using gdb to debug kernel causes crash | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Michael Hebenstreit <michael.hebenstreit> | ||||
| Component: | kernel | Assignee: | Prarit Bhargava <prarit> | ||||
| Status: | CLOSED ERRATA | QA Contact: | WANG Chao <chaowang> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 6.1 | CC: | arozansk, czhang, phan, ruyang | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | kernel-2.6.32-171.el6 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2011-12-06 13:32:50 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
|
Description
Michael Hebenstreit
2011-06-04 00:03:23 UTC
Hi Michael, I'm not set up to run gdb here -- you seem knowledgeable enough to backport the patch and test. Would you mind doing so and posting the result here? I can then see about backporting it to RHEL6. Thanks :) P. I used thia patch, seems to work now:
[mhebenst@eln1 development]$ cat linux-2.6.32-131.0.15.el6.x86_64.crt.1.debug/kgdb_1.patch
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 4b17b32..e8fd686 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -621,10 +621,8 @@ static void gdb_cmd_query(struct kgdb_state *ks)
switch (remcom_in_buffer[1]) {
case 's':
case 'f':
- if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10)) {
- error_packet(remcom_out_buffer, -EINVAL);
+ if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10))
break;
- }
i = 0;
remcom_out_buffer[0] = 'm';
@@ -665,10 +663,9 @@ static void gdb_cmd_query(struct kgdb_state *ks)
pack_threadid(remcom_out_buffer + 2, thref);
break;
case 'T':
- if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16)) {
- error_packet(remcom_out_buffer, -EINVAL);
+ if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16))
break;
- }
+
ks->threadid = 0;
ptr = remcom_in_buffer + 17;
kgdb_hex2long(&ptr, &ks->threadid);
Michael, thanks for testing. I will compile test and push for internal review. Again, thanks :) P. Michael, ... are you sure that's the patch? I don't see a kernel/debug/ dir in RHEL6... P. ups - you are right - I posted the original patch - here is my change to the RH kernel - second try:
--- linux-2.6.32-131.0.15.el6.x86_64.crt.1/kernel/kgdb.c 2009-12-02 19:51:21.000000000 -0800
+++ linux-2.6.32-131.0.15.el6.x86_64.crt.1.debug/kernel/kgdb.c 2011-06-03 16:12:29.596472000 -0700
@@ -1001,10 +1001,8 @@
switch (remcom_in_buffer[1]) {
case 's':
case 'f':
- if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10)) {
- error_packet(remcom_out_buffer, -EINVAL);
+ if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10))
break;
- }
i = 0;
remcom_out_buffer[0] = 'm';
@@ -1045,10 +1043,9 @@
pack_threadid(remcom_out_buffer + 2, thref);
break;
case 'T':
- if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16)) {
- error_packet(remcom_out_buffer, -EINVAL);
+ if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16))
break;
- }
+
ks->threadid = 0;
ptr = remcom_in_buffer + 17;
kgdb_hex2long(&ptr, &ks->threadid);
(In reply to comment #6) > ups - you are right - I posted the original patch - here is my change to the RH > kernel - second try: > Heh ... np :) I thought that was the what you backported to but I just wanted to make sure I post what you tested :) P. Created attachment 512725 [details]
RHEL6 patch for this issue
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Patch(es) available on kernel-2.6.32-171.el6 Just to mark how I setup kgdb environment: connect console serial port between two machines as target:/dev/ttyS0 <--> development:/dev/ttyUSB0 On target machine, add kernel param 'kgdboc=ttyS0,115200 kgdbwait'. On development machine, use gdb to load kernel-debuginfo/vmlinux. Reproduce on 2.6.32-131.15.el6: [snip] Reading symbols from /root/vmlinux-131...done. (gdb) target remote /dev/ttyUSB0 Remote debugging using /dev/ttyUSB0 0xffffffff810d42bb in kgdb_initial_breakpoint (new_kgdb_io_ops=0xffffffff81afe6e0) at kernel/kgdb.c:1630 1630 printk(KERN_CRIT "kgdb: Waiting for connection from remote gdb...\n"); trace API error 0x2. (gdb) quit Verified on 2.6.32-216.el6: [snip] Reading symbols from /root/vmlinux-214...done. (gdb) target remote /dev/ttyUSB0 Remote debugging using /dev/ttyUSB0 kgdb_breakpoint (new_kgdb_io_ops=0xffffffff81aff4a0) at kernel/kgdb.c:1718 1718 wmb(); /* Sync point after breakpoint */ (gdb) quit A debugging session is active. Inferior 1 [Remote target] will be killed. Quit anyway? (y or n) y On 2.6.32-216.el6, kgdb works correctly as expected(no error message) Set bug status to verified. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2011-1530.html |