Wed Jan 25 17:56:45 2017 UTC ()
The argument length is in bytes; don't use howmany()


(christos)
diff -r1.141 -r1.142 src/sys/kern/exec_elf32.c
diff -r1.6 -r1.7 src/sys/kern/exec_elf64.c

cvs diff -r1.141 -r1.142 src/sys/kern/exec_elf32.c (expand / switch to unified diff)

--- src/sys/kern/exec_elf32.c 2014/07/22 08:18:33 1.141
+++ src/sys/kern/exec_elf32.c 2017/01/25 17:56:45 1.142
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: exec_elf32.c,v 1.141 2014/07/22 08:18:33 maxv Exp $ */ 1/* $NetBSD: exec_elf32.c,v 1.142 2017/01/25 17:56:45 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Christopher G. Demetriou 4 * Copyright (c) 1996 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,36 +22,36 @@ @@ -22,36 +22,36 @@
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: exec_elf32.c,v 1.141 2014/07/22 08:18:33 maxv Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: exec_elf32.c,v 1.142 2017/01/25 17:56:45 christos Exp $");
36 36
37#define ELFSIZE 32 37#define ELFSIZE 32
38 38
39#include "exec_elf.c" 39#include "exec_elf.c"
40 40
41#include <sys/module.h> 41#include <sys/module.h>
42 42
43#define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \ 43#define ELF32_AUXSIZE (ELF_AUX_ENTRIES * sizeof(Aux32Info) \
44 sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1)) 44 + MAXPATHLEN + ALIGN(1))
45 45
46#ifdef COREDUMP 46#ifdef COREDUMP
47#define DEP "coredump" 47#define DEP "coredump"
48#else 48#else
49#define DEP NULL 49#define DEP NULL
50#endif 50#endif
51 51
52MODULE(MODULE_CLASS_EXEC, exec_elf32, DEP); 52MODULE(MODULE_CLASS_EXEC, exec_elf32, DEP);
53 53
54static struct execsw exec_elf32_execsw[] = { 54static struct execsw exec_elf32_execsw[] = {
55 { 55 {
56 .es_hdrsz = sizeof (Elf32_Ehdr), 56 .es_hdrsz = sizeof (Elf32_Ehdr),
57 .es_makecmds = exec_elf32_makecmds, 57 .es_makecmds = exec_elf32_makecmds,

cvs diff -r1.6 -r1.7 src/sys/kern/exec_elf64.c (expand / switch to unified diff)

--- src/sys/kern/exec_elf64.c 2014/07/22 08:18:33 1.6
+++ src/sys/kern/exec_elf64.c 2017/01/25 17:56:45 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: exec_elf64.c,v 1.6 2014/07/22 08:18:33 maxv Exp $ */ 1/* $NetBSD: exec_elf64.c,v 1.7 2017/01/25 17:56:45 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Christopher G. Demetriou 4 * Copyright (c) 1996 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,36 +22,36 @@ @@ -22,36 +22,36 @@
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: exec_elf64.c,v 1.6 2014/07/22 08:18:33 maxv Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: exec_elf64.c,v 1.7 2017/01/25 17:56:45 christos Exp $");
36 36
37#define ELFSIZE 64 37#define ELFSIZE 64
38 38
39#include "exec_elf.c" 39#include "exec_elf.c"
40 40
41#include <sys/module.h> 41#include <sys/module.h>
42 42
43#define ELF64_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux64Info), \ 43#define ELF64_AUXSIZE (ELF_AUX_ENTRIES * sizeof(Aux64Info) \
44 sizeof(Elf64_Addr)) + MAXPATHLEN + ALIGN(1)) 44 + MAXPATHLEN + ALIGN(1))
45 45
46#ifdef COREDUMP 46#ifdef COREDUMP
47#define DEP "coredump" 47#define DEP "coredump"
48#else 48#else
49#define DEP NULL 49#define DEP NULL
50#endif 50#endif
51 51
52MODULE(MODULE_CLASS_EXEC, exec_elf64, DEP); 52MODULE(MODULE_CLASS_EXEC, exec_elf64, DEP);
53 53
54static struct execsw exec_elf64_execsw[] = { 54static struct execsw exec_elf64_execsw[] = {
55 /* Native Elf64 */ 55 /* Native Elf64 */
56 { 56 {
57 .es_hdrsz = sizeof (Elf64_Ehdr), 57 .es_hdrsz = sizeof (Elf64_Ehdr),