[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#159633: strncpy on alpha/libc broken



On Sun, Sep 08, 2002 at 11:57:36AM -0400, Daniel Jacobowitz wrote:
> 
> This patch is incorrect, unfortunately:
> 
> {standard input}:182: Error: symbol `xdr_bp_whoambp_wh' is already defined
> {standard input}:187: Error: symbol `$xdr_bp_whoambp_wh..ng' is already defined

This error doesn't seem related to stxncpy, but I'm doing a glibc build
now to see if I can reproduce it.
 
> I'm not quite sure why your patch doesn't work but I think that
> $u_late_head_exit is the wrong exit point... and I'm not sure why the

u_late_head_exit is the right exit point for that place since it also
deals with end-of-count by oring t7 with t10.

> extra subtract was needed.  I was testing a branch to $u_eocfin but
> that isn't right either...

Without the extra subtract, the load in the loop may cause a SEGV...
Try strncpy(buf, page + 8169, 20).

I've got a better patch in terms of scheduling now.

As to sending it upstream, I'd simply send it to Richard Henderson
as he is the author of that file which is in both Linux and glibc.
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--- stxncpy.S	2001-07-24 03:55:20.000000000 +1000
+++ /home/gondolin/herbert/stxncpy.S	2002-09-08 22:22:07.000000000 +1000
@@ -189,10 +189,11 @@
 	mskql	t6, a1, t6		# e0    :   already seen
 	stq_u	t0, 0(a0)		# e0    : store first output word
 	or      t6, t2, t2		# .. e1 :
+	addq	a0, 8, a0		# e0    :
+	subq	a2, 1, a2		# .. e1 :
 	cmpbge	zero, t2, t7		# e0    : find nulls in second partial
-	addq	a0, 8, a0		# .. e1 :
-	subq	a2, 1, a2		# e0    :
-	bne	t7, $u_late_head_exit	# .. e1 :
+	beq	a2, $u_late_head_exit   # .. e1 :
+	bne	t7, $u_late_head_exit	# e1    :
 
 	/* Finally, we've got all the stupid leading edge cases taken care
 	   of and we can set up to enter the main loop.  */
@@ -200,8 +201,9 @@
 	extql	t2, a1, t1	# e0    : position hi-bits of lo word
 	ldq_u	t2, 8(a1)	# .. e1 : read next high-order source word
 	addq	a1, 8, a1	# e0    :
-	cmpbge	zero, t2, t7	# e1 (stall)
-	beq	a2, $u_eoc	# e1    :
+	subq	a2, 1, a2       # .. e1 :
+	cmpbge	zero, t2, t7	# e0    :
+	beq	a2, $u_eoc	# .. e1 :
 	bne	t7, $u_eos	# e1    :
 
 	/* Unaligned copy main loop.  In order to avoid reading too much,

Reply to: