Skip to contentSkip to conversation

module loading ELF handling - use SELFMAG instead of numeric constant

PATCH Applied Cyrill Gorcunov 3 participants 8 messages May 3, 2008 – May 4, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#3 lore raw

PATCH 2/4 module loading ELF handling - use SELFMAG instead of numeric constant

In reply to a message not in the archive

---

kernel/module.c +1 -1
Index: linux-2.6.git/kernel/module.c
===================================================================
@@ -1758,7 +1758,7 @@ static struct module *load_module(void _
 
 	/* Sanity checks against insmoding binaries or wrong arch,
            weird elf version */
-	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
+	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
 	    || hdr->e_type != ET_REL
 	    || !elf_check_arch(hdr)
 	    || hdr->e_shentsize != sizeof(*sechdrs)) {
#1 lore raw

PATCH 1/4 x86: vdso ELF handling - use SELFMAG instead of numeric constant

In reply to a message not in the archive

---

arch/x86/vdso/vdso32-setup.c +1 -1
Index: linux-2.6.git/arch/x86/vdso/vdso32-setup.c
===================================================================
@@ -162,7 +162,7 @@ static __init void relocate_vdso(Elf32_E
 	Elf32_Shdr *shdr;
 	int i;
 
-	BUG_ON(memcmp(ehdr->e_ident, ELFMAG, 4) != 0 ||
+	BUG_ON(memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
 	       !elf_check_arch_ia32(ehdr) ||
 	       ehdr->e_type != ET_DYN);
 
#4 lore raw

PATCH 3/4 x86: relocs ELF handling - use SELFMAG instead of numeric constant

In reply to a message not in the archive

---

arch/x86/boot/compressed/relocs.c +1 -1
Index: linux-2.6.git/arch/x86/boot/compressed/relocs.c
===================================================================
@@ -191,7 +191,7 @@ static void read_ehdr(FILE *fp)
 		die("Cannot read ELF header: %s\n",
 			strerror(errno));
 	}
-	if (memcmp(ehdr.e_ident, ELFMAG, 4) != 0) {
+	if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
 		die("No ELF magic\n");
 	}
 	if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) {
#6 lore raw

PATCH 4/4 MIPS: ELF handling - use SELFMAG instead of numeric constant

In reply to a message not in the archive

---

arch/mips/kernel/vpe.c +1 -1
Index: linux-2.6.git/arch/mips/kernel/vpe.c
===================================================================
@@ -840,7 +840,7 @@ static int vpe_elfload(struct vpe * v)
 
 	/* Sanity checks against insmoding binaries or wrong arch,
 	   weird elf version */
-	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
+	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
 	    || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
 	    || !elf_check_arch(hdr)
 	    || hdr->e_shentsize != sizeof(*sechdrs)) {
#7 lore raw

Re: [patch 4/4] MIPS: ELF handling - use SELFMAG instead of numeric constant

[Cyrill Gorcunov - Sat, May 03, 2008 at 02:18:04PM +0400]

| Signed-off-by: Cyrill Gorcunov <[email protected]>
| ---
| 
| Index: linux-2.6.git/arch/mips/kernel/vpe.c
| ===================================================================
| --- linux-2.6.git.orig/arch/mips/kernel/vpe.c	2008-04-15 23:01:26.000000000 +0400
| +++ linux-2.6.git/arch/mips/kernel/vpe.c	2008-05-02 21:40:57.000000000 +0400
| @@ -840,7 +840,7 @@ static int vpe_elfload(struct vpe * v)
|  
|  	/* Sanity checks against insmoding binaries or wrong arch,
|  	   weird elf version */
| -	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
| +	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
|  	    || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
|  	    || !elf_check_arch(hdr)
|  	    || hdr->e_shentsize != sizeof(*sechdrs)) {
| 
| -- 
| 

oops, MIPS was not refreshed by whole. This is a fix.
---

From: Cyrill Gorcunov <[email protected]>
Subject: MIPS: ELF handling - use SELFMAG instead of numeric constant

---

arch/mips/kernel/vpe.c +2 -2
Index: linux-2.6.git/arch/mips/kernel/vpe.c
===================================================================
@@ -840,7 +840,7 @@ static int vpe_elfload(struct vpe * v)
 
 	/* Sanity checks against insmoding binaries or wrong arch,
 	   weird elf version */
-	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
+	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
 	    || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
 	    || !elf_check_arch(hdr)
 	    || hdr->e_shentsize != sizeof(*sechdrs)) {
@@ -1107,7 +1107,7 @@ static int vpe_release(struct inode *ino
 		return -ENODEV;
 
 	hdr = (Elf_Ehdr *) v->pbuffer;
-	if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) {
+	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
 		if (vpe_elfload(v) >= 0) {
 			vpe_run(v);
 		} else {
#2 lore raw

Re: [patch 1/4] x86: vdso ELF handling - use SELFMAG instead of numeric constant

In reply to Cyrill Gorcunov
Quoted 8 lines · Cyrill Gorcunov

---

Index: linux-2.6.git/arch/x86/vdso/vdso32-setup.c
===================================================================

arch/x86/vdso/vdso32-setup.c static __init void relocate_vdso(Elf32_E · line 167

Quoted 7 lines
arch/x86/vdso/vdso32-setup.c +1 -1
@@ -162,7 +162,7 @@ static __init void relocate_vdso(Elf32_E
 	Elf32_Shdr *shdr;
 	int i;
 
-	BUG_ON(memcmp(ehdr->e_ident, ELFMAG, 4) != 0 ||
+	BUG_ON(memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
 	       !elf_check_arch_ia32(ehdr) ||
 	       ehdr->e_type != ET_DYN);

Applied. Thanks,

tglx

#5 lore raw

Re: [patch 3/4] x86: relocs ELF handling - use SELFMAG instead of numeric constant

In reply to Cyrill Gorcunov
Quoted 8 lines · Cyrill Gorcunov

---

Index: linux-2.6.git/arch/x86/boot/compressed/relocs.c
===================================================================

arch/x86/boot/compressed/relocs.c static void read_ehdr(FILE *fp) · line 197

Quoted 8 lines
arch/x86/boot/compressed/relocs.c +1 -1
@@ -191,7 +191,7 @@ static void read_ehdr(FILE *fp)
 		die("Cannot read ELF header: %s\n",
 			strerror(errno));
 	}
-	if (memcmp(ehdr.e_ident, ELFMAG, 4) != 0) {
+	if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
 		die("No ELF magic\n");
 	}
 	if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) {

Applied. Thanks,

tglx

Applied
#8 lore raw

Re: [patch 4/4] MIPS: ELF handling - use SELFMAG instead of numeric constant

In reply to Cyrill Gorcunov
Quoted 28 lines · Cyrill Gorcunov

From: Cyrill Gorcunov <[email protected]>
Date: Sat, 3 May 2008 14:35:58 +0400
To: [email protected], [email protected], [email protected],
[email protected], [email protected]
Subject: Re: [patch 4/4] MIPS: ELF handling - use SELFMAG instead of
numeric constant
Content-Type: text/plain; charset=us-ascii

[Cyrill Gorcunov - Sat, May 03, 2008 at 02:18:04PM +0400]

| Signed-off-by: Cyrill Gorcunov <[email protected]>
| ---
| 
| Index: linux-2.6.git/arch/mips/kernel/vpe.c
| ===================================================================
| --- linux-2.6.git.orig/arch/mips/kernel/vpe.c	2008-04-15 23:01:26.000000000 +0400
| +++ linux-2.6.git/arch/mips/kernel/vpe.c	2008-05-02 21:40:57.000000000 +0400
| @@ -840,7 +840,7 @@ static int vpe_elfload(struct vpe * v)
|  
|  	/* Sanity checks against insmoding binaries or wrong arch,
|  	   weird elf version */
| -	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
| +	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
|  	    || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
|  	    || !elf_check_arch(hdr)
|  	    || hdr->e_shentsize != sizeof(*sechdrs)) {
| 
| -- 
| 
Quoted 7 lines

oops, MIPS was not refreshed by whole. This is a fix.
---

From: Cyrill Gorcunov <[email protected]>
Subject: MIPS: ELF handling - use SELFMAG instead of numeric constant

Applied. Thanks!

Ralf