Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Provide a compatibility define for binaries generat...



details:   https://anonhg.NetBSD.org/src/rev/341380495119
branches:  trunk
changeset: 796926:341380495119
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jun 25 17:10:39 2014 +0000

description:
Provide a compatibility define for binaries generated before NetBSD 1.5.
These binaries contain multiple notes per section and their NetBSD version
value is 199905. This is enabled via COMPAT_OLDNOTE (default off).

diffstat:

 sys/kern/exec_elf.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r faeec99f2a76 -r 341380495119 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c       Wed Jun 25 16:38:53 2014 +0000
+++ b/sys/kern/exec_elf.c       Wed Jun 25 17:10:39 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf.c,v 1.66 2014/05/15 19:37:22 christos Exp $   */
+/*     $NetBSD: exec_elf.c,v 1.67 2014/06/25 17:10:39 christos Exp $   */
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.66 2014/05/15 19:37:22 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.67 2014/06/25 17:10:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -870,6 +870,10 @@
        int error;
        int isnetbsd = 0;
        char *ndata, *ndesc;
+#ifdef COMPAT_OLDNOTE
+       int compat_oldnote = -1;
+#endif
+       
 #ifdef DIAGNOSTIC
        const char *badnote;
 #define BADNOTE(n) badnote = (n)
@@ -919,6 +923,9 @@
                    roundup(np->n_descsz, 4);
                if (nsize != shp->sh_size) {
                        BADNOTE("note size");
+#ifdef COMPAT_OLDNOTE
+                       if (nsize > shp->sh_size || compat_oldnote == 0)
+#endif
                        goto bad;
                }
                ndesc = ndata + roundup(np->n_namesz, 4);
@@ -933,6 +940,9 @@
                                memcpy(&epp->ep_osversion, ndesc,
                                    ELF_NOTE_NETBSD_DESCSZ);
                                isnetbsd = 1;
+#ifdef COMPAT_OLDNOTE
+                               compat_oldnote = epp->ep_osversion == 199905;
+#endif
                                break;
                        }
 
@@ -944,6 +954,10 @@
                            memcmp(ndata, ELF_NOTE_SUSE_NAME,
                            ELF_NOTE_SUSE_NAMESZ) == 0)
                                break;
+#ifdef COMPAT_OLDNOTE
+                       if (compat_oldnote == 1)
+                               break;
+#endif
                        BADNOTE("NetBSD tag");
                        goto bad;
 



Home | Main Index | Thread Index | Old Index