Skip to contentSkip to conversation

kernel,debug: SPARC KGDB stub strcpy fix

PATCH In review Konrad Eisele 2 participants 5 messages Sep 30, 2011 – Oct 12, 2011 KGDB / KDB /debug_core

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 kernel,debug: SPARC KGDB stub strcpy fix

Works aroung the fact that strcpy in SPARC returns 0.

---
 kernel/debug/gdbstub.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/debug/gdbstub.c +2 -1
index a11db95..380753e 100644
@@ -946,7 +946,8 @@ int gdb_serial_stub(struct kgdb_state *ks)
 		ptr = remcom_out_buffer;
 		*ptr++ = 'T';
 		ptr = pack_hex_byte(ptr, ks->signo);
-		ptr += strlen(strcpy(ptr, "thread:"));
+		strcpy(ptr, "thread:");
+		ptr += strlen(ptr);
 		int_to_threadref(thref, shadow_pid(current->pid));
 		ptr = pack_threadid(ptr, thref);
 		*ptr++ = ';';
Signature · 1 line
1.6.4.1
#2 lore raw
In reply to Konrad Eisele
Quoted 5 lines · David Miller

From: Konrad Eisele <[email protected]>
Date: Fri, 30 Sep 2011 15:47:30 +0200

Quoted 2 lines

Works aroung the fact that strcpy in SPARC returns 0.

Quoted 9 lines
Quoted 1 line

Fix strcpy() on SPARC instead please.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

It is a gcc optimization. strcpy(p,"string") is converted to memcpy(p,7). I could think of 2 ways:
- fix memcpy() so that it returns the dest-pointer instead of 0. (However there might be a reason that it returns 0 ...
- keep the "kernel,debug: SPARC KGDB stub strcpy fix" patch but change the summary of the patch to:
Works aroung the fact that strcpy with a constant string is converted to memcpy by gcc and that memcpy in SPARC returns 0.

I'll send the 2 possibilities as a reply in a moment.

-- Konrad

#3 lore raw
In reply to Konrad Eisele

From: Konrad Eisele <[email protected]>
Date: Tue, 11 Oct 2011 14:16:01 +0200

Quoted 10 lines

It is a gcc optimization. strcpy(p,"string") is converted to memcpy(p,7). I could think of 2 ways:
- fix memcpy() so that it returns the dest-pointer instead of 0. (However there might be a reason that it returns 0 ...
- keep the "kernel,debug: SPARC KGDB stub strcpy fix" patch but change the summary of the patch to:
Works aroung the fact that strcpy with a constant string is converted to memcpy by gcc and that memcpy in SPARC returns 0.

I'll send the 2 possibilities as a reply in a moment.

I think memcpy() should be fixed to return the dest pointer.

#4 lore raw
In reply to Konrad Eisele
Quoted 12 lines · David Miller

From: Konrad Eisele <[email protected]>
Date: Tue, 11 Oct 2011 14:16:01 +0200

Quoted 9 lines

It is a gcc optimization. strcpy(p,"string") is converted to memcpy(p,7). I could think of 2 ways:
- fix memcpy() so that it returns the dest-pointer instead of 0. (However there might be a reason that it returns 0 ...
- keep the "kernel,debug: SPARC KGDB stub strcpy fix" patch but change the summary of the patch to:
Works aroung the fact that strcpy with a constant string is converted to memcpy by gcc and that memcpy in SPARC returns 0.

Quoted 5 lines
Quoted 1 line

I'll send the 2 possibilities as a reply in a moment.

I think memcpy() should be fixed to return the dest pointer.

In that case the patchset would be (I sent them 10/11/2011 02:18 PM):

+ 0001-apbuart-add-polling-callbacks-to-apbuart-driver.patch
+ 0002-apbuart-add-support-for-virtual-KGDB-GRMON-channel.patch
+ 0004-sparc32-return-destination-pointer-on-return-from-me.patch
+ 0005-sparc32-Add-support-for-KGDB-with-SMP-for-leon-and-s.patch

and skip the "0003-kernel-debug-SPARC-KGDB-stub-strcpy-fix.patch"

-- Konrad