Re: svn commit: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/sys

2018-06-05 Thread Mark Johnston
On Tue, Jun 05, 2018 at 03:50:12PM +0800, Ganbold Tsagaankhuu wrote:
> On Tue, Jun 5, 2018 at 3:35 AM, Mark Johnston  wrote:
> 
> > Author: markj
> > Date: Mon Jun  4 19:35:15 2018
> > New Revision: 334626
> > URL: https://svnweb.freebsd.org/changeset/base/334626
> >
> > Log:
> >   Reimplement brk() and sbrk() to avoid the use of _end.
> >
> >   Previously, libc.so would initialize its notion of the break address
> >   using _end, a special symbol emitted by the static linker following
> >   the bss section.  Compatibility issues between lld and ld.bfd could
> >   cause the wrong definition of _end (libc.so's definition rather than
> >   that of the executable) to be used, breaking the brk()/sbrk()
> >   interface.
> >
> >   Avoid this problem and future interoperability issues by simply not
> >   relying on _end.  Instead, modify the break() system call to return
> >   the kernel's view of the current break address, and have libc
> >   initialize its state using an extra syscall upon the first use of the
> >   interface.  As a side effect, this appears to fix brk()/sbrk() usage
> >   in executables run with rtld direct exec, since the kernel and libc.so
> >   no longer maintain separate views of the process' break address.
> >
> 
> 
> Maybe it is not really related, or I'm doing something wrong, but when I
> try to run release.sh script on FreeBSD 11.0-RELEASE-p9 to build pine64
> image, it stops with error:

r334653 should fix that, sorry.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/

2018-06-05 Thread Cy Schubert
In message 
, Ganbold Tsagaankhuu writes:
> On Tue, Jun 5, 2018 at 3:35 AM, Mark Johnston  wrote:
>
> > Author: markj
> > Date: Mon Jun  4 19:35:15 2018
> > New Revision: 334626
> > URL: https://svnweb.freebsd.org/changeset/base/334626
> >
> > Log:
> >   Reimplement brk() and sbrk() to avoid the use of _end.
> >
> >   Previously, libc.so would initialize its notion of the break address
> >   using _end, a special symbol emitted by the static linker following
> >   the bss section.  Compatibility issues between lld and ld.bfd could
> >   cause the wrong definition of _end (libc.so's definition rather than
> >   that of the executable) to be used, breaking the brk()/sbrk()
> >   interface.
> >
> >   Avoid this problem and future interoperability issues by simply not
> >   relying on _end.  Instead, modify the break() system call to return
> >   the kernel's view of the current break address, and have libc
> >   initialize its state using an extra syscall upon the first use of the
> >   interface.  As a side effect, this appears to fix brk()/sbrk() usage
> >   in executables run with rtld direct exec, since the kernel and libc.so
> >   no longer maintain separate views of the process' break address.
> >
>
>
> Maybe it is not really related, or I'm doing something wrong, but when I
> try to run release.sh script on FreeBSD 11.0-RELEASE-p9 to build pine64
> image, it stops with error:
> ...
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
> >>> referenced by brk_test.c:52 (/usr/src/lib/libc/tests/sys/brk_test.c:52)
> >>>   brk_test.o:(atfu_brk_basic_body)
>
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
> >>> referenced by brk_test.c:55 (/usr/src/lib/libc/tests/sys/brk_test.c:55)
> >>>   brk_test.o:(atfu_brk_basic_body)
>
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
> >>> referenced by brk_test.c:59 (/usr/src/lib/libc/tests/sys/brk_test.c:59)
> >>>   brk_test.o:(atfu_brk_basic_body)
>
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
> >>> referenced by brk_test.c:65 (/usr/src/lib/libc/tests/sys/brk_test.c:65)
> >>>   brk_test.o:(atfu_brk_basic_body)
>
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
> >>> referenced by brk_test.c:67 (/usr/src/lib/libc/tests/sys/brk_test.c:67)
> >>>   brk_test.o:(atfu_brk_basic_body)
>
> /usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
> >>> referenced by brk_test.c:82 (/usr/src/lib/libc/tests/sys/brk_test.c:82)
> >>>   brk_test.o:(atfu_sbrk_basic_body)
> ...
>
> Ganbold

Do a clean build or at the very least remove all libc objects and 
depends, the while directory in /usr/obj, and build again.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/sys

2018-06-05 Thread Ganbold Tsagaankhuu
On Tue, Jun 5, 2018 at 3:35 AM, Mark Johnston  wrote:

> Author: markj
> Date: Mon Jun  4 19:35:15 2018
> New Revision: 334626
> URL: https://svnweb.freebsd.org/changeset/base/334626
>
> Log:
>   Reimplement brk() and sbrk() to avoid the use of _end.
>
>   Previously, libc.so would initialize its notion of the break address
>   using _end, a special symbol emitted by the static linker following
>   the bss section.  Compatibility issues between lld and ld.bfd could
>   cause the wrong definition of _end (libc.so's definition rather than
>   that of the executable) to be used, breaking the brk()/sbrk()
>   interface.
>
>   Avoid this problem and future interoperability issues by simply not
>   relying on _end.  Instead, modify the break() system call to return
>   the kernel's view of the current break address, and have libc
>   initialize its state using an extra syscall upon the first use of the
>   interface.  As a side effect, this appears to fix brk()/sbrk() usage
>   in executables run with rtld direct exec, since the kernel and libc.so
>   no longer maintain separate views of the process' break address.
>


Maybe it is not really related, or I'm doing something wrong, but when I
try to run release.sh script on FreeBSD 11.0-RELEASE-p9 to build pine64
image, it stops with error:
...
/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
>>> referenced by brk_test.c:52 (/usr/src/lib/libc/tests/sys/brk_test.c:52)
>>>   brk_test.o:(atfu_brk_basic_body)

/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
>>> referenced by brk_test.c:55 (/usr/src/lib/libc/tests/sys/brk_test.c:55)
>>>   brk_test.o:(atfu_brk_basic_body)

/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
>>> referenced by brk_test.c:59 (/usr/src/lib/libc/tests/sys/brk_test.c:59)
>>>   brk_test.o:(atfu_brk_basic_body)

/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: brk
>>> referenced by brk_test.c:65 (/usr/src/lib/libc/tests/sys/brk_test.c:65)
>>>   brk_test.o:(atfu_brk_basic_body)

/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
>>> referenced by brk_test.c:67 (/usr/src/lib/libc/tests/sys/brk_test.c:67)
>>>   brk_test.o:(atfu_brk_basic_body)

/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin/ld: error: undefined symbol: sbrk
>>> referenced by brk_test.c:82 (/usr/src/lib/libc/tests/sys/brk_test.c:82)
>>>   brk_test.o:(atfu_sbrk_basic_body)
...

Ganbold


>
>   PR:   228574
>   Reviewed by:  kib (previous version)
>   MFC after:2 months
>   Differential Revision:https://reviews.freebsd.org/D15663
>
> Added:
>   head/lib/libc/sys/brk.c   (contents, props changed)
>   head/lib/libc/tests/sys/brk_test.c   (contents, props changed)
> Deleted:
>   head/lib/libc/amd64/sys/brk.S
>   head/lib/libc/amd64/sys/sbrk.S
>   head/lib/libc/arm/sys/brk.S
>   head/lib/libc/arm/sys/sbrk.S
>   head/lib/libc/i386/sys/brk.S
>   head/lib/libc/i386/sys/sbrk.S
>   head/lib/libc/mips/sys/brk.S
>   head/lib/libc/mips/sys/sbrk.S
>   head/lib/libc/powerpc/sys/brk.S
>   head/lib/libc/powerpc/sys/sbrk.S
>   head/lib/libc/powerpc64/sys/brk.S
>   head/lib/libc/powerpc64/sys/sbrk.S
>   head/lib/libc/sparc64/sys/brk.S
>   head/lib/libc/sparc64/sys/sbrk.S
> Modified:
>   head/lib/libc/amd64/Symbol.map
>   head/lib/libc/amd64/sys/Makefile.inc
>   head/lib/libc/arm/Symbol.map
>   head/lib/libc/arm/sys/Makefile.inc
>   head/lib/libc/i386/Symbol.map
>   head/lib/libc/i386/sys/Makefile.inc
>   head/lib/libc/mips/Symbol.map
>   head/lib/libc/mips/sys/Makefile.inc
>   head/lib/libc/powerpc/Symbol.map
>   head/lib/libc/powerpc/sys/Makefile.inc
>   head/lib/libc/powerpc64/Symbol.map
>   head/lib/libc/powerpc64/sys/Makefile.inc
>   head/lib/libc/riscv/sys/Makefile.inc
>   head/lib/libc/sparc64/Symbol.map
>   head/lib/libc/sparc64/sys/Makefile.inc
>   head/lib/libc/sys/Makefile.inc
>   head/lib/libc/sys/brk.2
>   head/lib/libc/tests/sys/Makefile
>   head/sys/compat/freebsd32/syscalls.master
>   head/sys/kern/syscalls.master
>   head/sys/vm/vm_unix.c
>
> Modified: head/lib/libc/amd64/Symbol.map
> 
> ==
> --- head/lib/libc/amd64/Symbol.map  Mon Jun  4 18:51:06 2018
> (r334625)
> +++ head/lib/libc/amd64/Symbol.map  Mon Jun  4 19:35:15 2018
> (r334626)
> @@ -63,7 +63,6 @@ FBSDprivate_1.0 {
> signalcontext;
> __siglongjmp;
> _brk;
> -   _end;
> __sys_vfork;
> _vfork;
>  };
>
> Modified: head/lib/libc/amd64/sys/Makefile.inc
> 
> ==
> --- head/lib/libc/amd64/sys/Makefile.incMon Jun  4 18:51:06 2018
>   (r334625)
> +++ head/lib/libc/amd64/sys/Makefile.incMon Jun  4 19:35:15 2018
>   (r334626)
> @@ -8,7 +8,7 @@ SRCS+=  \
> amd64_set_fsbase.c \
> amd64_s

svn commit: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/sys ...

2018-06-04 Thread Mark Johnston
Author: markj
Date: Mon Jun  4 19:35:15 2018
New Revision: 334626
URL: https://svnweb.freebsd.org/changeset/base/334626

Log:
  Reimplement brk() and sbrk() to avoid the use of _end.
  
  Previously, libc.so would initialize its notion of the break address
  using _end, a special symbol emitted by the static linker following
  the bss section.  Compatibility issues between lld and ld.bfd could
  cause the wrong definition of _end (libc.so's definition rather than
  that of the executable) to be used, breaking the brk()/sbrk()
  interface.
  
  Avoid this problem and future interoperability issues by simply not
  relying on _end.  Instead, modify the break() system call to return
  the kernel's view of the current break address, and have libc
  initialize its state using an extra syscall upon the first use of the
  interface.  As a side effect, this appears to fix brk()/sbrk() usage
  in executables run with rtld direct exec, since the kernel and libc.so
  no longer maintain separate views of the process' break address.
  
  PR:   228574
  Reviewed by:  kib (previous version)
  MFC after:2 months
  Differential Revision:https://reviews.freebsd.org/D15663

Added:
  head/lib/libc/sys/brk.c   (contents, props changed)
  head/lib/libc/tests/sys/brk_test.c   (contents, props changed)
Deleted:
  head/lib/libc/amd64/sys/brk.S
  head/lib/libc/amd64/sys/sbrk.S
  head/lib/libc/arm/sys/brk.S
  head/lib/libc/arm/sys/sbrk.S
  head/lib/libc/i386/sys/brk.S
  head/lib/libc/i386/sys/sbrk.S
  head/lib/libc/mips/sys/brk.S
  head/lib/libc/mips/sys/sbrk.S
  head/lib/libc/powerpc/sys/brk.S
  head/lib/libc/powerpc/sys/sbrk.S
  head/lib/libc/powerpc64/sys/brk.S
  head/lib/libc/powerpc64/sys/sbrk.S
  head/lib/libc/sparc64/sys/brk.S
  head/lib/libc/sparc64/sys/sbrk.S
Modified:
  head/lib/libc/amd64/Symbol.map
  head/lib/libc/amd64/sys/Makefile.inc
  head/lib/libc/arm/Symbol.map
  head/lib/libc/arm/sys/Makefile.inc
  head/lib/libc/i386/Symbol.map
  head/lib/libc/i386/sys/Makefile.inc
  head/lib/libc/mips/Symbol.map
  head/lib/libc/mips/sys/Makefile.inc
  head/lib/libc/powerpc/Symbol.map
  head/lib/libc/powerpc/sys/Makefile.inc
  head/lib/libc/powerpc64/Symbol.map
  head/lib/libc/powerpc64/sys/Makefile.inc
  head/lib/libc/riscv/sys/Makefile.inc
  head/lib/libc/sparc64/Symbol.map
  head/lib/libc/sparc64/sys/Makefile.inc
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/brk.2
  head/lib/libc/tests/sys/Makefile
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master
  head/sys/vm/vm_unix.c

Modified: head/lib/libc/amd64/Symbol.map
==
--- head/lib/libc/amd64/Symbol.map  Mon Jun  4 18:51:06 2018
(r334625)
+++ head/lib/libc/amd64/Symbol.map  Mon Jun  4 19:35:15 2018
(r334626)
@@ -63,7 +63,6 @@ FBSDprivate_1.0 {
signalcontext;
__siglongjmp;
_brk;
-   _end;
__sys_vfork;
_vfork;
 };

Modified: head/lib/libc/amd64/sys/Makefile.inc
==
--- head/lib/libc/amd64/sys/Makefile.incMon Jun  4 18:51:06 2018
(r334625)
+++ head/lib/libc/amd64/sys/Makefile.incMon Jun  4 19:35:15 2018
(r334626)
@@ -8,7 +8,7 @@ SRCS+=  \
amd64_set_fsbase.c \
amd64_set_gsbase.c
 
-MDASM= vfork.S brk.S cerror.S getcontext.S sbrk.S
+MDASM= vfork.S cerror.S getcontext.S
 
 # Don't generate default code for these syscalls:
-NOASM+=vfork.o
+NOASM+=sbrk.o vfork.o

Modified: head/lib/libc/arm/Symbol.map
==
--- head/lib/libc/arm/Symbol.mapMon Jun  4 18:51:06 2018
(r334625)
+++ head/lib/libc/arm/Symbol.mapMon Jun  4 19:35:15 2018
(r334626)
@@ -58,7 +58,6 @@ FBSDprivate_1.0 {
__sys_vfork;
_vfork;
_brk;
-   _end;
_sbrk;
 
_libc_arm_fpu_present;

Modified: head/lib/libc/arm/sys/Makefile.inc
==
--- head/lib/libc/arm/sys/Makefile.inc  Mon Jun  4 18:51:06 2018
(r334625)
+++ head/lib/libc/arm/sys/Makefile.inc  Mon Jun  4 19:35:15 2018
(r334626)
@@ -2,7 +2,7 @@
 
 SRCS+= __vdso_gettc.c
 
-MDASM= Ovfork.S brk.S cerror.S sbrk.S syscall.S
+MDASM= Ovfork.S cerror.S syscall.S
 
 # Don't generate default code for these syscalls:
-NOASM+=vfork.o
+NOASM+=sbrk.o vfork.o

Modified: head/lib/libc/i386/Symbol.map
==
--- head/lib/libc/i386/Symbol.map   Mon Jun  4 18:51:06 2018
(r334625)
+++ head/lib/libc/i386/Symbol.map   Mon Jun  4 19:35:15 2018
(r334626)
@@ -61,6 +61,5 @@ FBSDprivate_1.0 {
__siglongjmp;
__sys_vfork;
_vfork;
-   _end;
_brk;
 };

Modified: head/lib/libc/i386/sys/Makefile.inc
=