Deleted Added
full compact
linux_sysvec.c (346812) linux_sysvec.c (346816)
1/*-
2 * Copyright (c) 1994-1996 S��ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994-1996 S��ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/11/sys/i386/linux/linux_sysvec.c 346812 2019-04-28 09:53:08Z dchagin $");
30__FBSDID("$FreeBSD: stable/11/sys/i386/linux/linux_sysvec.c 346816 2019-04-28 13:19:28Z dchagin $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/exec.h>
35#include <sys/fcntl.h>
36#include <sys/imgact.h>
37#include <sys/imgact_aout.h>
38#include <sys/imgact_elf.h>

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

821
822 td->td_retval[0] = 0;
823 td->td_retval[1] = frame->tf_edx;
824
825 return (0);
826}
827
828/*
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/exec.h>
35#include <sys/fcntl.h>
36#include <sys/imgact.h>
37#include <sys/imgact_aout.h>
38#include <sys/imgact_elf.h>

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

821
822 td->td_retval[0] = 0;
823 td->td_retval[1] = frame->tf_edx;
824
825 return (0);
826}
827
828/*
829 * If a linux binary is exec'ing something, try this image activator
829 * If a Linux binary is exec'ing something, try this image activator
830 * first. We override standard shell script execution in order to
830 * first. We override standard shell script execution in order to
831 * be able to modify the interpreter path. We only do this if a linux
831 * be able to modify the interpreter path. We only do this if a Linux
832 * binary is doing the exec, so we do not create an EXEC module for it.
833 */
834static int exec_linux_imgact_try(struct image_params *iparams);
835
836static int
837exec_linux_imgact_try(struct image_params *imgp)
838{
839 const char *head = (const char *)imgp->image_header;
840 char *rpath;
841 int error = -1;
842
843 /*
832 * binary is doing the exec, so we do not create an EXEC module for it.
833 */
834static int exec_linux_imgact_try(struct image_params *iparams);
835
836static int
837exec_linux_imgact_try(struct image_params *imgp)
838{
839 const char *head = (const char *)imgp->image_header;
840 char *rpath;
841 int error = -1;
842
843 /*
844 * The interpreter for shell scripts run from a linux binary needs
844 * The interpreter for shell scripts run from a Linux binary needs
845 * to be located in /compat/linux if possible in order to recursively
845 * to be located in /compat/linux if possible in order to recursively
846 * maintain linux path emulation.
846 * maintain Linux path emulation.
847 */
848 if (((const short *)head)[0] == SHELLMAGIC) {
849 /*
850 * Run our normal shell image activator. If it succeeds attempt
851 * to use the alternate path for the interpreter. If an alternate
852 * path is found, use our stringspace to store it.
853 */
854 if ((error = exec_shell_imgact(imgp)) == 0) {

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

1018 p = (uintptr_t)(note + 1);
1019 p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
1020
1021 desc = (const Elf32_Word *)p;
1022 if (desc[0] != GNULINUX_ABI_DESC)
1023 return (FALSE);
1024
1025 /*
847 */
848 if (((const short *)head)[0] == SHELLMAGIC) {
849 /*
850 * Run our normal shell image activator. If it succeeds attempt
851 * to use the alternate path for the interpreter. If an alternate
852 * path is found, use our stringspace to store it.
853 */
854 if ((error = exec_shell_imgact(imgp)) == 0) {

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

1018 p = (uintptr_t)(note + 1);
1019 p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
1020
1021 desc = (const Elf32_Word *)p;
1022 if (desc[0] != GNULINUX_ABI_DESC)
1023 return (FALSE);
1024
1025 /*
1026 * For linux we encode osrel as follows (see linux_mib.c):
1026 * For Linux we encode osrel as follows (see linux_mib.c):
1027 * VVVMMMIII (version, major, minor), see linux_mib.c.
1028 */
1029 *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
1030
1031 return (TRUE);
1032}
1033
1034static Elf_Brandnote linux_brandnote = {

--- 125 unchanged lines hidden ---
1027 * VVVMMMIII (version, major, minor), see linux_mib.c.
1028 */
1029 *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
1030
1031 return (TRUE);
1032}
1033
1034static Elf_Brandnote linux_brandnote = {

--- 125 unchanged lines hidden ---