Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common - fix constants and explain limit



details:   https://anonhg.NetBSD.org/src/rev/88549a3408dc
branches:  trunk
changeset: 324103:88549a3408dc
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jul 15 21:31:00 2018 +0000

description:
- fix constants and explain limit
- use machine32 instead of hard-coded x86 stuff

diffstat:

 sys/compat/linux/common/linux_exec_elf32.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 6eafca37e13b -r 88549a3408dc sys/compat/linux/common/linux_exec_elf32.c
--- a/sys/compat/linux/common/linux_exec_elf32.c        Sun Jul 15 18:55:05 2018 +0000
+++ b/sys/compat/linux/common/linux_exec_elf32.c        Sun Jul 15 21:31:00 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec_elf32.c,v 1.96 2018/07/09 05:43:35 msaitoh Exp $    */
+/*     $NetBSD: linux_exec_elf32.c,v 1.97 2018/07/15 21:31:00 christos Exp $   */
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.96 2018/07/09 05:43:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.97 2018/07/15 21:31:00 christos Exp $");
 
 #ifndef ELFSIZE
 /* XXX should die */
@@ -323,8 +323,9 @@
                goto out;
        }
 
-       if (sh[i].sh_size > 1024 * 1014)
-               sh[i].sh_size = 1014 * 1014;
+       // Don't scan more than 1MB
+       if (sh[i].sh_size > 1024 * 1024)
+               sh[i].sh_size = 1024 * 1024;
 
        tmp = malloc(sh[i].sh_size, M_TEMP, M_WAITOK);
        error = exec_read_from(l, epp->ep_vp, sh[i].sh_offset, tmp,
@@ -333,8 +334,9 @@
                goto out;
 
 #if (ELFSIZE == 32)
-       if (strcmp(machine, "amd64") == 0)
-               m = "i386";
+       extern const char machine32[] __weak;
+       if (machine32 != NULL)
+               m = machine32;
        else
                m = machine;
 #else



Home | Main Index | Thread Index | Old Index