lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131004103117.1612.24104.stgit@f19-x64>
Date:	Fri, 04 Oct 2013 16:01:17 +0530
From:	Janani Venkataraman <jananive@...ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	amwang@...hat.com, rdunlap@...otime.net, andi@...stfloor.org,
	aravinda@...ux.vnet.ibm.com, hch@....de, mhiramat@...hat.com,
	jeremy.fitzhardinge@...rix.com, xemul@...allels.com,
	suzuki@...ux.vnet.ibm.com, kosaki.motohiro@...fujitsu.com,
	adobriyan@...il.com, tarundsk@...ux.vnet.ibm.com,
	vapier@...too.org, roland@...k.frob.com, tj@...nel.org,
	ananth@...ux.vnet.ibm.com, gorcunov@...nvz.org, avagin@...nvz.org,
	oleg@...hat.com, eparis@...hat.com, d.hatayama@...fujitsu.com,
	james.hogan@...tec.com, akpm@...ux-foundation.org,
	torvalds@...ux-foundation.org
Subject: [PATCH 05/19] Export the reusable ELF core generation routines

From:Suzuki K. Poulose <suzuki@...ibm.com>

Export the ELF class specific core generation helper functions via
elfcore-internal.h

Signed-off-by: Suzuki K. Poulose <suzuki@...ibm.com>
---
 fs/binfmt_elf.c                  |   10 +++++-----
 include/linux/elfcore-internal.h |   28 +++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 4eee017..3f13203 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1137,7 +1137,7 @@ static int writenote(struct memelfnote *men, struct file *file,
 }
 #undef DUMP_WRITE
 
-static void fill_elf_header(struct elfhdr *elf, int segs,
+void fill_elf_header(struct elfhdr *elf, int segs,
 			    u16 machine, u32 flags)
 {
 	memset(elf, 0, sizeof(*elf));
@@ -1177,7 +1177,7 @@ static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
  * fill up all the fields in prstatus from the given task struct, except
  * registers which need to be filled up separately.
  */
-static void fill_prstatus(struct elf_prstatus *prstatus,
+void fill_prstatus(struct elf_prstatus *prstatus,
 		struct task_struct *p, long signr)
 {
 	prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
@@ -1210,7 +1210,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
 	cputime_to_timeval(p->signal->cstime, &prstatus->pr_cstime);
 }
 
-static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
+int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
 		       struct mm_struct *mm)
 {
 	const struct cred *cred;
@@ -1265,7 +1265,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
 	return 0;
 }
 
-static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
+void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
 {
 	elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
 	int i = 0;
@@ -1858,7 +1858,7 @@ static void free_note_info(struct elf_note_info *info)
 
 #endif
 
-static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum,
+void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum,
 			     elf_addr_t e_shoff, int segs)
 {
 	elf->e_shoff = e_shoff;
diff --git a/include/linux/elfcore-internal.h b/include/linux/elfcore-internal.h
index 9e9cd93..8c5323a 100644
--- a/include/linux/elfcore-internal.h
+++ b/include/linux/elfcore-internal.h
@@ -14,7 +14,7 @@
 #define __ELF_CORE_INTERNAL_H
 
 #ifdef __KERNEL__
-
+#include <linux/elfcore.h>
 /* An ELF note in memory */
 struct memelfnote
 {
@@ -42,5 +42,31 @@ extern unsigned long vma_dump_size(struct task_struct *task,
 					struct vm_area_struct *vma,
 					unsigned long mm_flags);
 
+/* Core dump generation routines for native ELF class */
+extern void fill_elf_header(struct elfhdr *elf, int segs,
+				u16 machine, u32 flags);
+extern void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr,
+				elf_addr_t e_shoff, int segs);
+extern void fill_prstatus(struct elf_prstatus *prstatus,
+				struct task_struct *p, long signr);
+extern int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
+				struct mm_struct *mm);
+extern void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm);
+
+/* compat ELF class variant of the above helpers*/
+#ifdef CONFIG_COMPAT_BINFMT_ELF
+#include <linux/elfcore-compat.h>
+
+extern void compat_fill_extnum_info(struct elf32_hdr *elf, struct elf32_shdr *shdr,
+					Elf32_Addr e_shoff, int segs);
+extern void compat_fill_prstatus(struct compat_elf_prstatus *prstatus,
+					struct task_struct *p, long signr);
+extern int compat_fill_psinfo(struct compat_elf_prpsinfo *psinfo, struct task_struct *p,
+				struct mm_struct *mm);
+extern void compat_fill_auxv_note(struct memelfnote *note, struct mm_struct *mm);
+extern void compat_fill_elf_header(struct elf32_hdr *elf, int segs,
+					u16 machine, u32 flags);
+#endif /* CONFIG_COMPAT_BINFMT_ELF */
+
 #endif
 #endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ