rpms/kernel/devel kernel.spec, 1.24, 1.25 linux-2.6-elf-core-sysctl.patch, 1.1, 1.2

Roland McGrath (roland) fedora-extras-commits at redhat.com
Sat Jul 21 09:30:05 UTC 2007


Author: roland

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31121

Modified Files:
	kernel.spec linux-2.6-elf-core-sysctl.patch 
Log Message:
Update linux-2.6-elf-core-sysctl.patch


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- kernel.spec	21 Jul 2007 00:30:23 -0000	1.24
+++ kernel.spec	21 Jul 2007 09:29:32 -0000	1.25
@@ -19,7 +19,7 @@
 # setup, we set fedora_cvs_origin to the current cvs revision s/1.// of the
 # kernel spec when the kernel is rebased, so fedora_build automatically
 # works out to the offset from the rebase, so it doesn't get too ginormous.
-# 
+#
 # Bah. Have to set this to a negative for the moment to fix rpm ordering after
 # moving the spec file. cvs sucks. Should be sure to fix this once 2.6.23 is out.
 %define fedora_cvs_origin -17
@@ -1209,7 +1209,7 @@
 ApplyPatch linux-2.6-compile-fixes.patch
 
 # core dump enhancement
-#ApplyPatch linux-2.6-elf-core-sysctl.patch
+ApplyPatch linux-2.6-elf-core-sysctl.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -2133,6 +2133,9 @@
 %endif
 
 %changelog
+* Sat Jul 21 2007 Roland McGrath <roland at redhat.com>
+- Update linux-2.6-elf-core-sysctl.patch
+
 * Fri Jul 20 2007 John W. Linville <linville at redhat.com>
 - Update git-wireless-dev.patch (rt2x00 update)
 

linux-2.6-elf-core-sysctl.patch:

Index: linux-2.6-elf-core-sysctl.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-elf-core-sysctl.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-elf-core-sysctl.patch	12 Jul 2007 01:33:31 -0000	1.1
+++ linux-2.6-elf-core-sysctl.patch	21 Jul 2007 09:29:32 -0000	1.2
@@ -1,6 +1,6 @@
-From 1504394653a48c4e798bdd8dfdb11bdb48d07254 Mon Sep 17 00:00:00 2001
+From 3fc969e9b3913c1153124c179ad7fff4df1afda9 Mon Sep 17 00:00:00 2001
 From: Roland McGrath <roland at redhat.com>
-Date: Thu, 24 May 2007 19:09:53 -0700
+Date: Thu, 19 Jul 2007 13:44:13 -0700
 Subject: [PATCH] Add sysctl controls on ELF core dump segments, dump first page of DSOs
 
 This adds two sysctl items under fs.binfmt_elf for controlling how memory
@@ -16,11 +16,11 @@
 
 Signed-off-by: Roland McGrath <roland at redhat.com>
 ---
- fs/binfmt_elf.c |  152 ++++++++++++++++++++++++++++++++++++++++++++++---------
- 1 files changed, 128 insertions(+), 24 deletions(-)
+ fs/binfmt_elf.c |  158 ++++++++++++++++++++++++++++++++++++++++++++++---------
+ 1 files changed, 132 insertions(+), 26 deletions(-)
 
 diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
-index fa8ea33..af5537c 100644
+index ba24cb2..a6e659c 100644
 --- a/fs/binfmt_elf.c
 +++ b/fs/binfmt_elf.c
 @@ -20,6 +20,7 @@
@@ -31,7 +31,7 @@
  #include <linux/string.h>
  #include <linux/file.h>
  #include <linux/fcntl.h>
-@@ -1151,6 +1152,10 @@ out:
+@@ -1224,6 +1225,10 @@ out:
   * Modelled on fs/exec.c:aout_core_dump()
   * Jeremy Fitzhardinge <jeremy at sw.oz.au>
   */
@@ -42,7 +42,7 @@
  /*
   * These are the only things you should do on a core-file: use only these
   * functions to write out all the necessary info.
-@@ -1183,31 +1188,60 @@ static int dump_seek(struct file *file, loff_t off)
+@@ -1256,17 +1261,14 @@ static int dump_seek(struct file *file, loff_t off)
  }
  
  /*
@@ -53,8 +53,9 @@
 - * I think we should skip something. But I am not sure how. H.J.
 + * Decide what to dump of a segment, part, all or none.
   */
--static int maydump(struct vm_area_struct *vma)
-+static unsigned long vma_dump_size(struct vm_area_struct *vma)
+-static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
++static unsigned long vma_dump_size(struct vm_area_struct *vma,
++				   unsigned long mm_flags)
  {
  	/* The vma can be set up to tell us the answer directly.  */
  	if (vma->vm_flags & VM_ALWAYSDUMP)
@@ -63,26 +64,29 @@
  
  	/* Do not dump I/O mapped devices or special mappings */
  	if (vma->vm_flags & (VM_IO | VM_RESERVED))
- 		return 0;
+@@ -1274,17 +1276,51 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
  
- 	/* Dump shared memory only if mapped from an anonymous file. */
--	if (vma->vm_flags & VM_SHARED)
--		return vma->vm_file->f_path.dentry->d_inode->i_nlink == 0;
--
--	/* If it hasn't been written to, don't write it out */
--	if (!vma->anon_vma)
-+	if (vma->vm_flags & VM_SHARED) {
-+		if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0)
+ 	/* By default, dump shared memory if mapped from an anonymous file. */
+ 	if (vma->vm_flags & VM_SHARED) {
+-		if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0)
+-			return test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
+-		else
+-			return test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags);
++		if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
++		    test_bit(MMF_DUMP_ANON_SHARED, &mm_flags) :
++		    test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags))
 +			goto whole;
- 		return 0;
++		return 0;
 +	}
- 
--	return 1;
++
 +	/* Dump segments that have been written to.  */
-+	if (vma->anon_vma)
-+		goto whole;
++	if (vma->anon_vma) {
++		if (test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags))
++			goto whole;
++		return 0;
++	}
 +
-+	if (dump_whole_segments)
++	if (dump_whole_segments || test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags))
 +		goto whole;
 +
 +	/*
@@ -107,16 +111,20 @@
 +		magic.elfmag[EI_MAG3] = ELFMAG3;
 +		if (get_user(word, header) == 0 && word == magic.cmp)
 +			return PAGE_SIZE;
-+	}
-+
+ 	}
+ 
+-	/* By default, if it hasn't been written to, don't write it out. */
+-	if (!vma->anon_vma)
+-		return test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags);
 +	return 0;
-+
+ 
+-	return test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags);
 +whole:
 +	return vma->vm_end - vma->vm_start;
  }
  
  /* An ELF note in memory */
-@@ -1642,16 +1676,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
+@@ -1731,16 +1767,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
  	for (vma = first_vma(current, gate_vma); vma != NULL;
  			vma = next_vma(vma, gate_vma)) {
  		struct elf_phdr phdr;
@@ -128,22 +136,22 @@
  		phdr.p_offset = offset;
  		phdr.p_vaddr = vma->vm_start;
  		phdr.p_paddr = 0;
--		phdr.p_filesz = maydump(vma) ? sz : 0;
+-		phdr.p_filesz = maydump(vma, mm_flags) ? sz : 0;
 -		phdr.p_memsz = sz;
-+		phdr.p_filesz = vma_dump_size(vma);
++		phdr.p_filesz = vma_dump_size(vma, mm_flags);
 +		phdr.p_memsz = vma->vm_end - vma->vm_start;
  		offset += phdr.p_filesz;
  		phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0;
  		if (vma->vm_flags & VM_WRITE)
-@@ -1692,13 +1723,11 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
+@@ -1782,13 +1815,11 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
  	for (vma = first_vma(current, gate_vma); vma != NULL;
  			vma = next_vma(vma, gate_vma)) {
  		unsigned long addr;
 +		unsigned long end;
  
--		if (!maydump(vma))
+-		if (!maydump(vma, mm_flags))
 -			continue;
-+		end = vma->vm_start + vma_dump_size(vma);
++		end = vma->vm_start + vma_dump_size(vma, mm_flags);
  
 -		for (addr = vma->vm_start;
 -		     addr < vma->vm_end;
@@ -152,7 +160,7 @@
  			struct page *page;
  			struct vm_area_struct *vma;
  
-@@ -1756,17 +1785,92 @@ cleanup:
+@@ -1846,17 +1877,92 @@ cleanup:
  #undef NUM_NOTES
  }
  
@@ -247,5 +255,5 @@
  
  core_initcall(init_elf_binfmt);
 -- 
-1.5.2.1
+1.5.2.2
 




More information about the scm-commits mailing list