Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 don't exec 32bit binary on the cpu ...



details:   https://anonhg.NetBSD.org/src/rev/915164441fd1
branches:  trunk
changeset: 446221:915164441fd1
user:      ryo <ryo%NetBSD.org@localhost>
date:      Wed Nov 28 08:12:15 2018 +0000

description:
don't exec 32bit binary on the cpu that has no aarch32.

diffstat:

 sys/arch/aarch64/aarch64/exec_machdep.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 79bcb8fec55d -r 915164441fd1 sys/arch/aarch64/aarch64/exec_machdep.c
--- a/sys/arch/aarch64/aarch64/exec_machdep.c   Wed Nov 28 05:19:13 2018 +0000
+++ b/sys/arch/aarch64/aarch64/exec_machdep.c   Wed Nov 28 08:12:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_machdep.c,v 1.3 2018/10/12 01:28:57 ryo Exp $ */
+/* $NetBSD: exec_machdep.c,v 1.4 2018/11/28 08:12:15 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: exec_machdep.c,v 1.3 2018/10/12 01:28:57 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_machdep.c,v 1.4 2018/11/28 08:12:15 ryo Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_netbsd32.h"
@@ -75,6 +75,14 @@
        if (!elf_aapcs_p)
                return ENOEXEC;
 
+       /*
+        * require aarch32 feature.
+        * XXX should consider some cluster may have no aarch32?
+        */
+       if (__SHIFTOUT(l->l_cpu->ci_id.ac_aa64pfr0, ID_AA64PFR0_EL1_EL0) !=
+           ID_AA64PFR0_EL1_EL0_64_32)
+               return ENOEXEC;
+
        return 0;
 }
 #endif



Home | Main Index | Thread Index | Old Index