Deleted Added
full compact
linux32_sysvec.c (346812) linux32_sysvec.c (346816)
1/*-
2 * Copyright (c) 2004 Tim J. Robbins
3 * Copyright (c) 2003 Peter Wemm
4 * Copyright (c) 2002 Doug Rabson
5 * Copyright (c) 1998-1999 Andrew Gallatin
6 * Copyright (c) 1994-1996 S��ren Schmidt
7 * All rights reserved.
8 *

--- 19 unchanged lines hidden (view full) ---

28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include "opt_compat.h"
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Tim J. Robbins
3 * Copyright (c) 2003 Peter Wemm
4 * Copyright (c) 2002 Doug Rabson
5 * Copyright (c) 1998-1999 Andrew Gallatin
6 * Copyright (c) 1994-1996 S��ren Schmidt
7 * All rights reserved.
8 *

--- 19 unchanged lines hidden (view full) ---

28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include "opt_compat.h"
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: stable/11/sys/amd64/linux32/linux32_sysvec.c 346812 2019-04-28 09:53:08Z dchagin $");
36__FBSDID("$FreeBSD: stable/11/sys/amd64/linux32/linux32_sysvec.c 346816 2019-04-28 13:19:28Z dchagin $");
37#include "opt_compat.h"
38
39#ifndef COMPAT_FREEBSD32
40#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!"
41#endif
42
43#define __ELF_WORD_SIZE 32
44

--- 687 unchanged lines hidden (view full) ---

732
733 td->td_retval[0] = 0;
734 td->td_retval[1] = frame->tf_rdx;
735
736 return (0);
737}
738
739/*
37#include "opt_compat.h"
38
39#ifndef COMPAT_FREEBSD32
40#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!"
41#endif
42
43#define __ELF_WORD_SIZE 32
44

--- 687 unchanged lines hidden (view full) ---

732
733 td->td_retval[0] = 0;
734 td->td_retval[1] = frame->tf_rdx;
735
736 return (0);
737}
738
739/*
740 * If a linux binary is exec'ing something, try this image activator
740 * If a Linux binary is exec'ing something, try this image activator
741 * first. We override standard shell script execution in order to
741 * first. We override standard shell script execution in order to
742 * be able to modify the interpreter path. We only do this if a linux
742 * be able to modify the interpreter path. We only do this if a Linux
743 * binary is doing the exec, so we do not create an EXEC module for it.
744 */
745static int exec_linux_imgact_try(struct image_params *iparams);
746
747static int
748exec_linux_imgact_try(struct image_params *imgp)
749{
750 const char *head = (const char *)imgp->image_header;
751 char *rpath;
752 int error = -1;
753
754 /*
743 * binary is doing the exec, so we do not create an EXEC module for it.
744 */
745static int exec_linux_imgact_try(struct image_params *iparams);
746
747static int
748exec_linux_imgact_try(struct image_params *imgp)
749{
750 const char *head = (const char *)imgp->image_header;
751 char *rpath;
752 int error = -1;
753
754 /*
755 * The interpreter for shell scripts run from a linux binary needs
755 * The interpreter for shell scripts run from a Linux binary needs
756 * to be located in /compat/linux if possible in order to recursively
756 * to be located in /compat/linux if possible in order to recursively
757 * maintain linux path emulation.
757 * maintain Linux path emulation.
758 */
759 if (((const short *)head)[0] == SHELLMAGIC) {
760 /*
761 * Run our normal shell image activator. If it succeeds attempt
762 * to use the alternate path for the interpreter. If an
763 * alternate * path is found, use our stringspace to store it.
764 */
765 if ((error = exec_shell_imgact(imgp)) == 0) {

--- 286 unchanged lines hidden (view full) ---

1052 p = (uintptr_t)(note + 1);
1053 p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
1054
1055 desc = (const Elf32_Word *)p;
1056 if (desc[0] != GNULINUX_ABI_DESC)
1057 return (FALSE);
1058
1059 /*
758 */
759 if (((const short *)head)[0] == SHELLMAGIC) {
760 /*
761 * Run our normal shell image activator. If it succeeds attempt
762 * to use the alternate path for the interpreter. If an
763 * alternate * path is found, use our stringspace to store it.
764 */
765 if ((error = exec_shell_imgact(imgp)) == 0) {

--- 286 unchanged lines hidden (view full) ---

1052 p = (uintptr_t)(note + 1);
1053 p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
1054
1055 desc = (const Elf32_Word *)p;
1056 if (desc[0] != GNULINUX_ABI_DESC)
1057 return (FALSE);
1058
1059 /*
1060 * For linux we encode osrel as follows (see linux_mib.c):
1060 * For Linux we encode osrel as follows (see linux_mib.c):
1061 * VVVMMMIII (version, major, minor), see linux_mib.c.
1062 */
1063 *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
1064
1065 return (TRUE);
1066}
1067
1068static Elf_Brandnote linux32_brandnote = {

--- 112 unchanged lines hidden ---
1061 * VVVMMMIII (version, major, minor), see linux_mib.c.
1062 */
1063 *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
1064
1065 return (TRUE);
1066}
1067
1068static Elf_Brandnote linux32_brandnote = {

--- 112 unchanged lines hidden ---