Re: svn commit: r361657 - head/sys/sys

2020-05-30 Thread Ed Maste
On Sat, 30 May 2020 at 19:39, Konstantin Belousov  wrote:
>
> > It looks like GNU ld has done it since 2015 in fact. Further, glibc
> > will refuse to dlopen() an object with DF_1_PIE set, as of last June;
> > this seems like it would be a reasonable thing for us to do too.
> >
> > glibc bug for this: https://sourceware.org/bugzilla/show_bug.cgi?id=24323
>
> I can do it.  What if such object is referenced by DT_NEEDED ?

Hmm, good question.

glibc has the following comment where they disallow it:
> +/* dlopen of an executable is not valid because it is not possible
> +   to perform proper relocations, handle static TLS, or run the
> +   ELF constructors.  For PIE, the check needs the dynamic
> +   section, so there is another check below.  */

I would suggest that if it's the case we cannot correctly dlopen or
handle a DT_NEEDED executable then we ought to fail.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361657 - head/sys/sys

2020-05-30 Thread Konstantin Belousov
On Sat, May 30, 2020 at 07:28:55PM -0400, Ed Maste wrote:
> On Sat, 30 May 2020 at 16:17, Ed Maste  wrote:
> >
> > On Sat, 30 May 2020 at 16:14, Konstantin Belousov  
> > wrote:
> > >
> > > On Sat, May 30, 2020 at 07:57:27PM +, Ed Maste wrote:
> > > > Author: emaste
> > > > Date: Sat May 30 19:57:26 2020
> > > > New Revision: 361657
> > > > URL: https://svnweb.freebsd.org/changeset/base/361657
> > > >
> > > > Log:
> > > >   elf_common.h: define DF_1_PIE
> > > >
> > > >   DF_1_PIE indicates that the object is a position-independent 
> > > > executable.
> > > Only on Solaris.
> >
> > Apparently GNU ld sets it broadly now, and there's a patch to have lld
> > start doing it: https://reviews.llvm.org/D80872
> 
> It looks like GNU ld has done it since 2015 in fact. Further, glibc
> will refuse to dlopen() an object with DF_1_PIE set, as of last June;
> this seems like it would be a reasonable thing for us to do too.
> 
> glibc bug for this: https://sourceware.org/bugzilla/show_bug.cgi?id=24323

I can do it.  What if such object is referenced by DT_NEEDED ?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361657 - head/sys/sys

2020-05-30 Thread Ed Maste
On Sat, 30 May 2020 at 16:17, Ed Maste  wrote:
>
> On Sat, 30 May 2020 at 16:14, Konstantin Belousov  wrote:
> >
> > On Sat, May 30, 2020 at 07:57:27PM +, Ed Maste wrote:
> > > Author: emaste
> > > Date: Sat May 30 19:57:26 2020
> > > New Revision: 361657
> > > URL: https://svnweb.freebsd.org/changeset/base/361657
> > >
> > > Log:
> > >   elf_common.h: define DF_1_PIE
> > >
> > >   DF_1_PIE indicates that the object is a position-independent executable.
> > Only on Solaris.
>
> Apparently GNU ld sets it broadly now, and there's a patch to have lld
> start doing it: https://reviews.llvm.org/D80872

It looks like GNU ld has done it since 2015 in fact. Further, glibc
will refuse to dlopen() an object with DF_1_PIE set, as of last June;
this seems like it would be a reasonable thing for us to do too.

glibc bug for this: https://sourceware.org/bugzilla/show_bug.cgi?id=24323
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361657 - head/sys/sys

2020-05-30 Thread Ed Maste
On Sat, 30 May 2020 at 16:14, Konstantin Belousov  wrote:
>
> On Sat, May 30, 2020 at 07:57:27PM +, Ed Maste wrote:
> > Author: emaste
> > Date: Sat May 30 19:57:26 2020
> > New Revision: 361657
> > URL: https://svnweb.freebsd.org/changeset/base/361657
> >
> > Log:
> >   elf_common.h: define DF_1_PIE
> >
> >   DF_1_PIE indicates that the object is a position-independent executable.
> Only on Solaris.

Apparently GNU ld sets it broadly now, and there's a patch to have lld
start doing it: https://reviews.llvm.org/D80872
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361657 - head/sys/sys

2020-05-30 Thread Konstantin Belousov
On Sat, May 30, 2020 at 07:57:27PM +, Ed Maste wrote:
> Author: emaste
> Date: Sat May 30 19:57:26 2020
> New Revision: 361657
> URL: https://svnweb.freebsd.org/changeset/base/361657
> 
> Log:
>   elf_common.h: define DF_1_PIE
>   
>   DF_1_PIE indicates that the object is a position-independent executable.
Only on Solaris.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361657 - head/sys/sys

2020-05-30 Thread Ed Maste
Author: emaste
Date: Sat May 30 19:57:26 2020
New Revision: 361657
URL: https://svnweb.freebsd.org/changeset/base/361657

Log:
  elf_common.h: define DF_1_PIE
  
  DF_1_PIE indicates that the object is a position-independent executable.
  
  Reference:
  https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Sat May 30 19:16:33 2020(r361656)
+++ head/sys/sys/elf_common.h   Sat May 30 19:57:26 2020(r361657)
@@ -764,6 +764,7 @@ typedef struct {
 #defineDF_1_ORIGIN 0x0080  /* Process $ORIGIN */
 #defineDF_1_INTERPOSE  0x0400  /* Interpose all objects but 
main */
 #defineDF_1_NODEFLIB   0x0800  /* Do not search default paths 
*/
+#defineDF_1_PIE0x0800  /* Is position-independent 
executable */
 
 /* Values for l_flags. */
 #defineLL_NONE 0x0 /* no flags */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"