Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 1999 13:23:39 +0100
From:      Marcel Moolenaar <marcel@scc.nl>
To:        emulation@FreeBSD.ORG
Subject:   Re: /lib/ld-linux.so.2 in 2.2.8
Message-ID:  <36EF9ECB.96C0FBA9@scc.nl>
References:  <36EEFB0C.C4A24A87@bigshed.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ken Marx wrote:

>         bash: /lib/ld-linux.so.2: cannot execute binary file
> 
> (Same as any wrongly attempted execution of any .so.)

To follow up on my on post:

The reason is in fact very simple. Linux allows the execution of shared
objects whereas FreeBSD doesn't. IMO, FreeBSD has it right: you don't execute
ELF binaries when they are not flagged as such.

For users of 2.x systems this is a bit annoying, since they do not have an
alternative. The problem can be solved by applying the following *untested*
patch on 2.2.7 and 2.2.8 systems:

*** imgact_elf.c.orig   Wed Mar 17 13:16:39 1999
--- imgact_elf.c        Wed Mar 17 13:19:34 1999
***************
*** 252,260 ****
        if (hdr->e_machine != EM_386 && hdr->e_machine != EM_486)
                return ENOEXEC;
  
!       if (hdr->e_type != type)
!               return ENOEXEC;
! 
        return 0;
  }
  
--- 252,266 ----
        if (hdr->e_machine != EM_386 && hdr->e_machine != EM_486)
                return ENOEXEC;
  
!       if (type == ET_EXEC) {
!               if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN)
!                       return ENOEXEC;
!       }
!       else {
!               if (hdr->e_type != type)
!                       return ENOEXEC;
!       }
! 
        return 0;
  }
  

An equivalent patch on my -current system does solve the problem. I just
don't have a 2.2.x system available for testing. In any case, you'll get the
drift...

marcel


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36EF9ECB.96C0FBA9>