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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131004103233.1612.24086.stgit@f19-x64>
Date:	Fri, 04 Oct 2013 16:02:34 +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 15/19] Calculate the size of the core file

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

Calculate the size of the core file

Signed-off-by: Suzuki K. Poulose <suzuki@...ibm.com>
Signed-off-by: Ananth N. Mavinakayanahalli <ananth@...ibm.com>
---
 fs/proc/gencore-elf.c |    6 ++++++
 fs/proc/gencore.h     |    1 +
 2 files changed, 7 insertions(+)

diff --git a/fs/proc/gencore-elf.c b/fs/proc/gencore-elf.c
index 6e97f6a..efd1722 100644
--- a/fs/proc/gencore-elf.c
+++ b/fs/proc/gencore-elf.c
@@ -291,6 +291,9 @@ static int create_elf_header(struct core_proc *cp)
 						dataoff, cp->nphdrs);
 		dataoff += sizeof(struct elf_shdr);
 	}
+
+	cp->size = dataoff;
+
 	/* Store the notes */
 	tinfo = cp->tinfo;
 	do {
@@ -351,6 +354,9 @@ ssize_t elf_read_gencore(struct core_proc *cp, char __user *buffer,
 			buffer += bcp;
 		}
 	}
+	if (*fpos > cp->size)
+		goto out;
+  
 out:
 	return ret;
 }
diff --git a/fs/proc/gencore.h b/fs/proc/gencore.h
index e508417..f6822f2 100644
--- a/fs/proc/gencore.h
+++ b/fs/proc/gencore.h
@@ -30,6 +30,7 @@ struct core_proc {
 	size_t elf_buflen;      /* size of elf_buf */
 	size_t nphdrs;          /* number of phdrs */
 	size_t notes_size;
+	size_t size;
 };
 
 #ifdef CORE_DUMP_USE_REGSET

--
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