kern/114049: [patch] sbrk(0) is broken on ARM architecture

Bjoern Koenig bkoenig at alpha-tierchen.de
Tue Jun 26 15:50:03 UTC 2007


>Number:         114049
>Category:       kern
>Synopsis:       [patch] sbrk(0) is broken on ARM architecture
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 26 15:50:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Bjoern Koenig
>Release:        FreeBSD 7.0-CURRENT arm
>Organization:
>Environment:
>Description:
	sbrk(0) is broken on ARM architecture.

	On May 16th 2007 the symbol "end" has been removed from the list of
	exported symbols in src/lib/libc/arm/Symbol.map. For this reason you
	needed to change "end" to "_end" in src/lib/libc/arm/sys/brk.S, but
	sbkr.S has been forgotten.
>How-To-Repeat:

cat > curbrk.c << EOF
#include <stdio.h>

int
main()
{
	printf("%08x\n", sbrk(0));
	return (0);
}
EOF
cc curbrk.c && ./a.out

The output is 'ffffffff' but should be something like '000106a0'.

>Fix:

--- src_lib_libc_arm_sys_sbkr.S begins here ---
--- HEAD/src/lib/libc/arm/sys/sbrk.S	2004-11-09 17:49:14.000000000 +0100
+++ HEAD-bkoenig/src/lib/libc/arm/sys/sbrk.S	2007-06-26 14:05:14.000000000 +0200
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/lib/libc/arm/sys/sbrk.S,v 1.2 2004/11/09 16:49:14 cognet Exp $");
 #include "SYS.h"
 
-	.globl	_C_LABEL(end)
+	.globl	_C_LABEL(_end)
 
 #ifdef WEAK_ALIAS
 WEAK_ALIAS(sbrk, _sbrk)
@@ -46,7 +46,7 @@
 	.globl	CURBRK
 	.type	CURBRK,#object
 CURBRK:
-	.word	_C_LABEL(end)
+	.word	_C_LABEL(_end)
 
 /*
  * Change the data segment size
--- src_lib_libc_arm_sys_sbkr.S ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list