Skip to contentSkip to conversation

UML 2.4 shmem.c changes? panic w/ backtrace

uml-devel D. Bahi 4 participants 8 messages Nov 23, 2004 – Mar 2, 2005

Subsystems (8)
lore
Share & tools
lore

D. Bahi

author
#0 lore raw

hello uml folks,

i know things are hot and heavy in 2.6 but i hope somebody can spare a thought about this panic i'm struggling to understand.

i know UML touches shmem.c - lightly and i'd like to think it's a kernel bug w/ shmem but we run this 2.4.20 kernel on hardware with the same applications and do not see this failure.

host is RH9 2.4.20-31.9 + skas
guest is UML 2.4.26-3um
backported to 2.4.20-montavista 3.1 pro

(gdb) bt

#0  0x08167aca in nanosleep () at proc_fs.h:154
#1  0x081679cb in sleep () at proc_fs.h:154
#2  0x080e3bc1 in stop () at user_util.c:52
#3  0x080e37ec in panic_waitonerr (self=0x81f77cc, unused1=0, unused2=0x8206120) at um_arch.c:457
#4  0x0805eeb2 in notifier_call_chain (n=0xfffffffc, val=0, v=0x8206120) at sys.c:131
#5  0x08053bb3 in panic (fmt=0x81c99c0 "Kernel mode fault at addr 0x%lx, ip 0x%lx") at panic.c:69
#6  0x080e2efd in segv (address=0, ip=1078054417, is_write=0, is_user=0, sc=0x30da82a4) at trap_kern.c:149
#7  0x080e31cd in segv_handler (sig=11, regs=0x30da82a4) at trap_user.c:74
#8  0x080e5611 in sig_handler_common_skas (sig=11, sc_ptr=0x58) at trap_user.c:35
#9  0x080e31ee in sig_handler (sig=11, sc={gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 49168, edi = 336, esi = 818643476, ebp = 819657132, esp = 819657124, ebx = 0, edx = 42, ecx = 818643560, eax = 0, trapno = 14, err = 4, eip = 134682879, cs = 35, __csh = 0, eflags = 2163270, esp_at_signal = 819657124, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 134217728, cr2 = 0}) at trap_user.c:109

#10 <signal handler called>
#11 shmem_block (index=42, page=0x0, direct=0x0, indirect=0x30cb8268) at shmem.c:149 #12 0x08071984 in shmem_swp_entry (info=0x0, index=42, page=0x0) at shmem.c:182 #13 0x08071aa5 in shmem_truncate (inode=0x30cb8100) at shmem.c:349
#14 0x08064772 in vmtruncate (inode=0x30cb8100, offset=172368) at memory.c:1128 #15 0x080898b9 in inode_setattr (inode=0x30cb8100, attr=0x30dafb24) at attr.c:67 #16 0x08071c16 in shmem_notify_change (dentry=0x0, attr=0x30dafb24) at shmem.c:398 #17 0x08089a3d in notify_change (dentry=0x30ed4878, attr=0x30dafb24) at attr.c:132 #18 0x08073f4a in do_truncate (dentry=0x30ed4878, length=172368) at open.c:113 #19 0x080751bf in do_sys_ftruncate (fd=0, length=172368, small=1) at open.c:220 #20 0x08073f8f in sys_ftruncate (fd=21, length=172368) at open.c:229 #21 0x080e5162 in execute_syscall_skas (r=0x2a) at syscall_kern.c:28 #22 0x080e5192 in handle_syscall (regs=0x30da82a4) at syscall_user.c:26 #23 0x080e43c1 in handle_trap (pid=5308, regs=0x30da82a4) at process.c:85 #24 0x080e4693 in userspace (regs=0x30da82a4) at process.c:160
#25 0x080e4dae in fork_handler (sig=10) at process_kern.c:104
#26 <signal handler called>
#27 0x0815a631 in kill () at proc_fs.h:154
#28 0x080e8708 in os_usr1_process (pid=5304) at process.c:98
#29 0x080e4706 in new_thread (stack=Cannot access memory at address 0x8 ) at process.c:197

Signature · 1 line
db
#1 lore raw
Quoted 7 lines · D. Bahi

hello uml folks,

i know things are hot and heavy in 2.6 but i hope
somebody can spare a thought about this panic i'm
struggling to understand.

i know UML touches shmem.c - lightly

I'll drop that change ASAP from the -bs tree - it's useless currently (it's a residual from older work).

Quoted 4 lines

and i'd like
to think it's a kernel bug w/ shmem but we run this 2.4.20 kernel on hardware with the same applications and do not see this failure.

If you don't access /dev/anon inside UML, that change should be a no-op. Should, however, means no certainty. But how do you reproduce that?

Quoted 4 lines

host is RH9 2.4.20-31.9 + skas

guest is UML 2.4.26-3um
backported to 2.4.20-montavista 3.1 pro

Err - what is this montavista tree? If it supports realtime, then the interaction is probably unlikely to be good.

Quoted 50 lines

(gdb) bt

#0  0x08167aca in nanosleep () at proc_fs.h:154
#1  0x081679cb in sleep () at proc_fs.h:154
#2  0x080e3bc1 in stop () at user_util.c:52
#3  0x080e37ec in panic_waitonerr (self=0x81f77cc, unused1=0,

unused2=0x8206120) at um_arch.c:457
#4 0x0805eeb2 in notifier_call_chain (n=0xfffffffc, val=0, v=0x8206120) at sys.c:131
#5 0x08053bb3 in panic (fmt=0x81c99c0 "Kernel mode fault at addr 0x%lx, ip 0x%lx") at panic.c:69
#6 0x080e2efd in segv (address=0, ip=1078054417, is_write=0, is_user=0, sc=0x30da82a4) at trap_kern.c:149
#7 0x080e31cd in segv_handler (sig=11, regs=0x30da82a4) at trap_user.c:74 #8 0x080e5611 in sig_handler_common_skas (sig=11, sc_ptr=0x58) at trap_user.c:35
#9 0x080e31ee in sig_handler (sig=11, sc={gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 49168, edi = 336, esi = 818643476, ebp = 819657132, esp = 819657124, ebx = 0, edx = 42, ecx = 818643560, eax = 0, trapno = 14, err = 4, eip = 134682879, cs = 35, __csh = 0, eflags = 2163270, esp_at_signal = 819657124, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 134217728, cr2 = 0}) at trap_user.c:109 #10 <signal handler called>
#11 shmem_block (index=42, page=0x0, direct=0x0, indirect=0x30cb8268) at shmem.c:149
#12 0x08071984 in shmem_swp_entry (info=0x0, index=42, page=0x0) at shmem.c:182
#13 0x08071aa5 in shmem_truncate (inode=0x30cb8100) at shmem.c:349 #14 0x08064772 in vmtruncate (inode=0x30cb8100, offset=172368) at memory.c:1128
#15 0x080898b9 in inode_setattr (inode=0x30cb8100, attr=0x30dafb24) at attr.c:67
#16 0x08071c16 in shmem_notify_change (dentry=0x0, attr=0x30dafb24) at shmem.c:398
#17 0x08089a3d in notify_change (dentry=0x30ed4878, attr=0x30dafb24) at attr.c:132
#18 0x08073f4a in do_truncate (dentry=0x30ed4878, length=172368) at open.c:113
#19 0x080751bf in do_sys_ftruncate (fd=0, length=172368, small=1) at open.c:220
#20 0x08073f8f in sys_ftruncate (fd=21, length=172368) at open.c:229 #21 0x080e5162 in execute_syscall_skas (r=0x2a) at syscall_kern.c:28 #22 0x080e5192 in handle_syscall (regs=0x30da82a4) at syscall_user.c:26 #23 0x080e43c1 in handle_trap (pid=5308, regs=0x30da82a4) at process.c:85 #24 0x080e4693 in userspace (regs=0x30da82a4) at process.c:160 #25 0x080e4dae in fork_handler (sig=10) at process_kern.c:104 #26 <signal handler called>
#27 0x0815a631 in kill () at proc_fs.h:154
#28 0x080e8708 in os_usr1_process (pid=5304) at process.c:98 #29 0x080e4706 in new_thread (stack=Cannot access memory at address 0x8 ) at process.c:197

Signature · 15 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
In reply to D. Bahi
Quoted 2 lines · [email protected] said:

i know things are hot and heavy in 2.6 but i hope somebody can spare a thought about this panic i'm struggling to understand.

Is this easily reproduced?

The stack isn't ringing any bells with me, particularly since none of my code appears on the stack until the bug has already happened.

Jeff

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#3 lore raw

This happens everytime i try to load an application of ours that uses shmem for syslog...

Quoted 8 lines · Jeff Dike
Quoted 4 lines · [email protected] said:

i know things are hot and heavy in 2.6 but i hope somebody can spare a thought about this panic i'm struggling to understand.

Quoted 9 lines

Is this easily reproduced?

The stack isn't ringing any bells with me, particularly since none of my code appears on the stack until the bug has already happened.

Jeff

--
db

#4 lore raw
Quoted 2 lines · [email protected] said:

This happens everytime i try to load an application of ours that uses shmem for syslog...

I persist in seeing no particular UML involvement with this crash :-)

Can you boil your app down to a test case which reproduces this?

Jeff

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#5 lore raw
Quoted 7 lines · Jeff Dike
Quoted 2 lines · [email protected] said:

This happens everytime i try to load an application of ours that uses shmem for syslog...

I persist in seeing no particular UML involvement with this crash :-)

Can you boil your app down to a test case which reproduces this?

Jeff, since the UML changes to the shmem.c code are currently unused, just to make sure, can you remove them from the patch, so that we can make sure? They are, actually, the devanon patch.

Or even you, D. Bahi?

Go reading the devanon patch on the site to understand exactly what to do (apart little rejects, it should probably be possible to reverse that patch). If you did the backporting to the 2.4.20 correctly (which can also be in doubt, since there is a bug - please don't get me wrong, I don't want to criticize you personally), you should be able to do it.

Be careful, because the changes are not insulated inside shmem.c: the addition of ->munmap inside <linux/fs.h>, all the references to it, the changes to shmem_fs.h... and maybe something else.

Signature · 16 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#6 lore raw
Quoted 5 lines · Blaisorblade
Quoted 4 lines · Jeff Dike
Quoted 2 lines · [email protected] said:

This happens everytime i try to load an application of ours that uses shmem for syslog...

Quoted 7 lines
Quoted 3 lines

I persist in seeing no particular UML involvement with this crash :-)

Can you boil your app down to a test case which reproduces this?

Jeff, since the UML changes to the shmem.c code are currently unused, just to make sure, can you remove them from the patch, so that we can make sure? They are, actually, the devanon patch.

Ok, D.Bahi, I found that I already prepared a patch to do this work. It also removes SKAS support for inner UML, btw, which is untested and probably would need some fixes. Apply the patch, and tell us the result.

Signature · 3 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade

---

 um-linux-2.4.27-paolo/arch/um/config.in        |    1 
 um-linux-2.4.27-paolo/arch/um/defconfig        |    1 
 um-linux-2.4.27-paolo/arch/um/kernel/ptrace.c  |   54 -------
 um-linux-2.4.27-paolo/drivers/char/mem.c       |    8 -
 um-linux-2.4.27-paolo/include/linux/fs.h       |    2 
 um-linux-2.4.27-paolo/include/linux/mm.h       |   13 -
 um-linux-2.4.27-paolo/include/linux/shmem_fs.h |    2 
 um-linux-2.4.27-paolo/mm/Makefile              |    1 
 um-linux-2.4.27-paolo/mm/mmap.c                |   12 -
 um-linux-2.4.27-paolo/mm/mprotect.c            |   14 --
 um-linux-2.4.27-paolo/mm/shmem.c               |  149 ---------------------
 um-linux-2.4.27/mm/proc_mm.c                   |  173 -------------------------
 12 files changed, 18 insertions(+), 412 deletions(-)
drivers/char/mem.c renamed from drivers/char/mem.c~remove-devanon-skas +1 -7
diff -puN drivers/char/mem.c~remove-devanon-skas drivers/char/mem.c
@@ -666,8 +666,6 @@ static struct file_operations full_fops 
 	write:		write_full,
 };
 
-extern struct file_operations anon_file_operations;
-
 static int memory_open(struct inode * inode, struct file * filp)
 {
 	switch (MINOR(inode->i_rdev)) {
@@ -697,9 +695,6 @@ static int memory_open(struct inode * in
 		case 9:
 			filp->f_op = &urandom_fops;
 			break;
-		case 10:
-		        filp->f_op = &anon_file_operations;
-			break;
 		default:
 			return -ENXIO;
 	}
@@ -726,8 +721,7 @@ void __init memory_devfs_register (void)
 	{5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
 	{7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
 	{8, "random",  S_IRUGO | S_IWUSR,           &random_fops},
-	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops},
-	{10, "anon", S_IRUGO | S_IWUSR,             &anon_file_operations},
+	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops}
     };
     int i;
 
include/linux/fs.h renamed from include/linux/fs.h~remove-devanon-skas +0 -2
diff -puN include/linux/fs.h~remove-devanon-skas include/linux/fs.h
@@ -870,8 +870,6 @@ struct file_operations {
 	unsigned int (*poll) (struct file *, struct poll_table_struct *);
 	int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
 	int (*mmap) (struct file *, struct vm_area_struct *);
-	void (*munmap) (struct file *, struct vm_area_struct *,
-			unsigned long start, unsigned long len);
 	int (*open) (struct inode *, struct file *);
 	int (*flush) (struct file *);
 	int (*release) (struct inode *, struct file *);
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~remove-devanon-skas +0 -2
diff -puN include/linux/shmem_fs.h~remove-devanon-skas include/linux/shmem_fs.h
@@ -22,8 +22,6 @@ struct shmem_inode_info {
 	unsigned long		next_index;
 	swp_entry_t		i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
 	void		      **i_indirect; /* indirect blocks */
-	unsigned long		map_direct[SHMEM_NR_DIRECT];
-	void 		      **map_indirect;
 	unsigned long		swapped;    /* data pages assigned to swap */
 	unsigned long		flags;
 	struct list_head	list;
mm/Makefile renamed from mm/Makefile~remove-devanon-skas +0 -1
diff -puN mm/Makefile~remove-devanon-skas mm/Makefile
@@ -17,6 +17,5 @@ obj-y	 := memory.o mmap.o filemap.o mpro
 	    shmem.o
 
 obj-$(CONFIG_HIGHMEM) += highmem.o
-obj-$(CONFIG_PROC_MM) += proc_mm.o
 
 include $(TOPDIR)/Rules.make
mm/mmap.c renamed from mm/mmap.c~remove-devanon-skas +3 -9
diff -puN mm/mmap.c~remove-devanon-skas mm/mmap.c
@@ -391,11 +391,10 @@ static int vma_merge(struct mm_struct * 
 	return 0;
 }
 
-unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
-			    unsigned long addr, unsigned long len,
-			    unsigned long prot, unsigned long flags,
-			    unsigned long pgoff)
+unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
+	unsigned long prot, unsigned long flags, unsigned long pgoff)
 {
+	struct mm_struct * mm = current->mm;
 	struct vm_area_struct * vma, * prev;
 	unsigned int vm_flags;
 	int correct_wcount = 0;
@@ -1001,11 +1000,6 @@ int do_munmap(struct mm_struct *mm, unsi
 		remove_shared_vm_struct(mpnt);
 		mm->map_count--;
 
-		if((mpnt->vm_file != NULL) && (mpnt->vm_file->f_op != NULL) &&
-		   (mpnt->vm_file->f_op->munmap != NULL))
-		        mpnt->vm_file->f_op->munmap(mpnt->vm_file, mpnt, st,
-						    size);
-
 		zap_page_range(mm, st, size);
 
 		/*
mm/mprotect.c renamed from mm/mprotect.c~remove-devanon-skas +4 -10
diff -puN mm/mprotect.c~remove-devanon-skas mm/mprotect.c
@@ -264,8 +264,7 @@ static int mprotect_fixup(struct vm_area
 	return 0;
 }
 
-long do_mprotect(struct mm_struct *mm, unsigned long start, size_t len,
-		 unsigned long prot)
+asmlinkage long sys_mprotect(unsigned long start, size_t len, unsigned long prot)
 {
 	unsigned long nstart, end, tmp;
 	struct vm_area_struct * vma, * next, * prev;
@@ -282,9 +281,9 @@ long do_mprotect(struct mm_struct *mm, u
 	if (end == start)
 		return 0;
 
-	down_write(&mm->mmap_sem);
+	down_write(&current->mm->mmap_sem);
 
-	vma = find_vma_prev(mm, start, &prev);
+	vma = find_vma_prev(current->mm, start, &prev);
 	error = -ENOMEM;
 	if (!vma || vma->vm_start > start)
 		goto out;
@@ -333,11 +332,6 @@ long do_mprotect(struct mm_struct *mm, u
 		prev->vm_mm->map_count--;
 	}
 out:
-	up_write(&mm->mmap_sem);
+	up_write(&current->mm->mmap_sem);
 	return error;
 }
-
-asmlinkage long sys_mprotect(unsigned long start, size_t len, unsigned long prot)
-{
-        return(do_mprotect(current->mm, start, len, prot));
-}
mm/proc_mm.c deleted +0 -173

173 lines not on this page · raw message

mm/shmem.c renamed from mm/shmem.c~remove-devanon-skas +6 -143

183 lines not on this page · raw message

arch/um/config.in renamed from arch/um/config.in~remove-devanon-skas +0 -1
diff -puN arch/um/config.in~remove-devanon-skas arch/um/config.in
@@ -52,7 +52,6 @@ fi
 int 'Nesting level' CONFIG_NEST_LEVEL 0
 int 'Kernel address space size (in .5G units)' CONFIG_KERNEL_HALF_GIGS 1
 bool 'Highmem support' CONFIG_HIGHMEM
-bool '/proc/mm' CONFIG_PROC_MM
 int 'Kernel stack size order' CONFIG_KERNEL_STACK_ORDER 2
 bool 'Real-time Clock' CONFIG_UML_REAL_TIME_CLOCK
 endmenu
arch/um/defconfig renamed from arch/um/defconfig~remove-devanon-skas +0 -1
diff -puN arch/um/defconfig~remove-devanon-skas arch/um/defconfig
@@ -37,7 +37,6 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_NEST_LEVEL=0
 CONFIG_KERNEL_HALF_GIGS=1
 # CONFIG_HIGHMEM is not set
-CONFIG_PROC_MM=y
 CONFIG_KERNEL_STACK_ORDER=2
 CONFIG_UML_REAL_TIME_CLOCK=y
 
arch/um/kernel/ptrace.c renamed from arch/um/kernel/ptrace.c~remove-devanon-skas +0 -54

66 lines not on this page · raw message

include/linux/mm.h renamed from include/linux/mm.h~remove-devanon-skas +4 -9
diff -puN include/linux/mm.h~remove-devanon-skas include/linux/mm.h
@@ -517,9 +517,6 @@ extern int ptrace_check_attach(struct ta
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
 		int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
 
-extern long do_mprotect(struct mm_struct *mm, unsigned long start,
-			size_t len, unsigned long prot);
-
 /*
  * On a two-level page table, this ends up being trivial. Thus the
  * inlining and the symmetry break with pte_alloc() that does all
@@ -567,10 +564,9 @@ extern void exit_mmap(struct mm_struct *
 
 extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
 
-extern unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file *file,
-				   unsigned long addr, unsigned long len,
-				   unsigned long prot, unsigned long flag,
-				   unsigned long pgoff);
+extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+	unsigned long len, unsigned long prot,
+	unsigned long flag, unsigned long pgoff);
 
 static inline unsigned long do_mmap(struct file *file, unsigned long addr,
 	unsigned long len, unsigned long prot,
@@ -580,8 +576,7 @@ static inline unsigned long do_mmap(stru
 	if ((offset + PAGE_ALIGN(len)) < offset)
 		goto out;
 	if (!(offset & ~PAGE_MASK))
-		ret = do_mmap_pgoff(current->mm, file, addr, len, prot, flag,
-				    offset >> PAGE_SHIFT);
+		ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
 out:
 	return ret;
 }

_

author
#7 lore raw

wow! thank you Blaisor. will apply and let you know. still working on an isolated shmem program that will reproduce this....

Quoted 680 lines · Blaisorblade
Quoted 10 lines · Blaisorblade
Quoted 7 lines · Jeff Dike
Quoted 4 lines · [email protected] said:

This happens everytime i try to load an application of ours that uses shmem for syslog...

Quoted 10 lines
Quoted 5 lines

I persist in seeing no particular UML involvement with this crash :-)

Can you boil your app down to a test case which reproduces this?

Jeff, since the UML changes to the shmem.c code are currently unused, just to make sure, can you remove them from the patch, so that we can make sure? They are, actually, the devanon patch.

Ok, D.Bahi, I found that I already prepared a patch to do this work. It also removes SKAS support for inner UML, btw, which is untested and probably would need some fixes. Apply the patch, and tell us the result.

------------------------------------------------------------------------

---

um-linux-2.4.27-paolo/arch/um/config.in        |    1
um-linux-2.4.27-paolo/arch/um/defconfig        |    1
um-linux-2.4.27-paolo/arch/um/kernel/ptrace.c  |   54 -------
um-linux-2.4.27-paolo/drivers/char/mem.c       |    8 -
um-linux-2.4.27-paolo/include/linux/fs.h       |    2
um-linux-2.4.27-paolo/include/linux/mm.h       |   13 -
um-linux-2.4.27-paolo/include/linux/shmem_fs.h |    2
um-linux-2.4.27-paolo/mm/Makefile              |    1
um-linux-2.4.27-paolo/mm/mmap.c                |   12 -
um-linux-2.4.27-paolo/mm/mprotect.c            |   14 --
um-linux-2.4.27-paolo/mm/shmem.c               |  149 ---------------------
um-linux-2.4.27/mm/proc_mm.c                   |  173 -------------------------
12 files changed, 18 insertions(+), 412 deletions(-)

diff -puN drivers/char/mem.c~remove-devanon-skas drivers/char/mem.c

drivers/char/mem.c renamed from drivers/char/mem.c~remove-devanon-skas +1 -7
@@ -666,8 +666,6 @@ static struct file_operations full_fops
 	write:		write_full,
 };
 
-extern struct file_operations anon_file_operations;
-
 static int memory_open(struct inode * inode, struct file * filp)
 {
 	switch (MINOR(inode->i_rdev)) {
@@ -697,9 +695,6 @@ static int memory_open(struct inode * in
 		case 9:
 			filp->f_op = &urandom_fops;
 			break;
-		case 10:
-		        filp->f_op = &anon_file_operations;
-			break;
 		default:
 			return -ENXIO;
 	}
@@ -726,8 +721,7 @@ void __init memory_devfs_register (void)
 	{5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
 	{7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
 	{8, "random",  S_IRUGO | S_IWUSR,           &random_fops},
-	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops},
-	{10, "anon", S_IRUGO | S_IWUSR,             &anon_file_operations},
+	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops}
    };
    int i;
 

diff -puN include/linux/fs.h~remove-devanon-skas include/linux/fs.h

include/linux/fs.h renamed from include/linux/fs.h~remove-devanon-skas +0 -2
@@ -870,8 +870,6 @@ struct file_operations {
 	unsigned int (*poll) (struct file *, struct poll_table_struct *);
 	int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
 	int (*mmap) (struct file *, struct vm_area_struct *);
-	void (*munmap) (struct file *, struct vm_area_struct *,
-			unsigned long start, unsigned long len);
 	int (*open) (struct inode *, struct file *);
 	int (*flush) (struct file *);
 	int (*release) (struct inode *, struct file *);

diff -puN include/linux/shmem_fs.h~remove-devanon-skas include/linux/shmem_fs.h

include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~remove-devanon-skas +0 -2
@@ -22,8 +22,6 @@ struct shmem_inode_info {
 	unsigned long		next_index;
 	swp_entry_t		i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
 	void		      **i_indirect; /* indirect blocks */
-	unsigned long		map_direct[SHMEM_NR_DIRECT];
-	void 		      **map_indirect;
 	unsigned long		swapped;    /* data pages assigned to swap */
 	unsigned long		flags;
 	struct list_head	list;

diff -puN mm/Makefile~remove-devanon-skas mm/Makefile

mm/Makefile renamed from mm/Makefile~remove-devanon-skas +0 -0
@@ -17,6 +17,5 @@ obj-y	 := memory.o mmap.o filemap.o mpro
 	    shmem.o
 

obj-$(CONFIG_HIGHMEM) += highmem.o
-obj-$(CONFIG_PROC_MM) += proc_mm.o

include $(TOPDIR)/Rules.make
diff -puN mm/mmap.c~remove-devanon-skas mm/mmap.c

mm/mmap.c renamed from mm/mmap.c~remove-devanon-skas +3 -9
@@ -391,11 +391,10 @@ static int vma_merge(struct mm_struct *
 	return 0;
 }
 
-unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
-			    unsigned long addr, unsigned long len,
-			    unsigned long prot, unsigned long flags,
-			    unsigned long pgoff)
+unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
+	unsigned long prot, unsigned long flags, unsigned long pgoff)
 {
+	struct mm_struct * mm = current->mm;
 	struct vm_area_struct * vma, * prev;
 	unsigned int vm_flags;
 	int correct_wcount = 0;
@@ -1001,11 +1000,6 @@ int do_munmap(struct mm_struct *mm, unsi
 		remove_shared_vm_struct(mpnt);
 		mm->map_count--;
 
-		if((mpnt->vm_file != NULL) && (mpnt->vm_file->f_op != NULL) &&
-		   (mpnt->vm_file->f_op->munmap != NULL))
-		        mpnt->vm_file->f_op->munmap(mpnt->vm_file, mpnt, st,
-						    size);
-
 		zap_page_range(mm, st, size);
 
 		/*

diff -puN mm/mprotect.c~remove-devanon-skas mm/mprotect.c

mm/mprotect.c renamed from mm/mprotect.c~remove-devanon-skas +3 -4
@@ -264,8 +264,7 @@ static int mprotect_fixup(struct vm_area
 	return 0;
 }
 
-long do_mprotect(struct mm_struct *mm, unsigned long start, size_t len,
-		 unsigned long prot)
+asmlinkage long sys_mprotect(unsigned long start, size_t len, unsigned long prot)
 {
 	unsigned long nstart, end, tmp;
 	struct vm_area_struct * vma, * next, * prev;
@@ -282,9 +281,9 @@ long do_mprotect(struct mm_struct *mm, u
 	if (end == start)
 		return 0;
 
-	down_write(&mm->mmap_sem);
+	down_write(&current->mm->mmap_sem);
 
-	vma = find_vma_prev(mm, start, &prev);
+	vma = find_vma_prev(current->mm, start, &prev);
 	error = -ENOMEM;
 	if (!vma || vma->vm_start > start)
 		goto out;
@@ -333,11 +332,6 @@ long do_mprotect(struct mm_struct *mm, u
 		prev->vm_mm->map_count--;
 	}

out:

mm/mprotect.c renamed from mm/mprotect.c~remove-devanon-skas +1 -1
-	up_write(&mm->mmap_sem);
+	up_write(&current->mm->mmap_sem);
	return error;
}
mm/mprotect.c renamed from mm/mprotect.c~remove-devanon-skas +0 -5
-
-asmlinkage long sys_mprotect(unsigned long start, size_t len, unsigned long prot)
-{
-        return(do_mprotect(current->mm, start, len, prot));
-}

diff -L mm/proc_mm.c -puN mm/proc_mm.c~remove-devanon-skas /dev/null

mm/proc_mm.c deleted +0 -173
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2002 Jeff Dike ([email protected])
- * Licensed under the GPL
- */
-
-#include "linux/init.h"
-#include "linux/proc_fs.h"
-#include "linux/proc_mm.h"
-#include "linux/file.h"
-#include "asm/uaccess.h"
-#include "asm/mmu_context.h"
-
-static struct file_operations proc_mm_fops;
-
-struct mm_struct *proc_mm_get_mm(int fd)
-{
-	struct mm_struct *ret = ERR_PTR(-EBADF);
-	struct file *file;
-
-	file = fget(fd);
-	if (!file)
-		goto out;
-
-	ret = ERR_PTR(-EINVAL);
-	if(file->f_op != &proc_mm_fops)
-		goto out_fput;
-
-	ret = file->private_data;
- out_fput:
-	fput(file);
- out:
-	return(ret);
-}
-
-extern long do_mmap2(struct mm_struct *mm, unsigned long addr,
-		     unsigned long len, unsigned long prot,
-		     unsigned long flags, unsigned long fd,
-		     unsigned long pgoff);
-
-static ssize_t write_proc_mm(struct file *file, const char *buffer,
-			     size_t count, loff_t *ppos)
-{
-	struct mm_struct *mm = file->private_data;
-	struct proc_mm_op req;
-	int n, ret;
-
-	if(count > sizeof(req))
-		return(-EINVAL);
-
-	n = copy_from_user(&req, buffer, count);
-	if(n != 0)
-		return(-EFAULT);
-
-	ret = count;
-	switch(req.op){
-	case MM_MMAP: {
-		struct mm_mmap *map = &req.u.mmap;
-
-		ret = do_mmap2(mm, map->addr, map->len, map->prot,
-			       map->flags, map->fd, map->offset >> PAGE_SHIFT);
-		if((ret & ~PAGE_MASK) == 0)
-			ret = count;
-
-		break;
-	}
-	case MM_MUNMAP: {
-		struct mm_munmap *unmap = &req.u.munmap;
-
-		down_write(&mm->mmap_sem);
-		ret = do_munmap(mm, unmap->addr, unmap->len);
-		up_write(&mm->mmap_sem);
-
-		if(ret == 0)
-			ret = count;
-		break;
-	}
-	case MM_MPROTECT: {
-		struct mm_mprotect *protect = &req.u.mprotect;
-
-		ret = do_mprotect(mm, protect->addr, protect->len,
-				  protect->prot);
-		if(ret == 0)
-			ret = count;
-		break;
-	}
-
-	case MM_COPY_SEGMENTS: {
-		struct mm_struct *from = proc_mm_get_mm(req.u.copy_segments);
-
-		if(IS_ERR(from)){
-			ret = PTR_ERR(from);
-			break;
-		}
-
-		mm_copy_segments(from, mm);
-		break;
-	}
-	default:
-		ret = -EINVAL;
-		break;
-	}
-
-	return(ret);
-}
-
-static int open_proc_mm(struct inode *inode, struct file *file)
-{
-	struct mm_struct *mm = mm_alloc();
-	int ret;
-
-	ret = -ENOMEM;
-	if(mm == NULL)
-		goto out_mem;
-
-	ret = init_new_context(current, mm);
-	if(ret)
-		goto out_free;
-
-	spin_lock(&mmlist_lock);
-	list_add(&mm->mmlist, &current->mm->mmlist);
-	mmlist_nr++;
-	spin_unlock(&mmlist_lock);
-
-	file->private_data = mm;
-
-	return(0);
-
- out_free:
-	mmput(mm);
- out_mem:
-	return(ret);
-}
-
-static int release_proc_mm(struct inode *inode, struct file *file)
-{
-	struct mm_struct *mm = file->private_data;
-
-	mmput(mm);
-	return(0);
-}
-
-static struct file_operations proc_mm_fops = {
-	.open		= open_proc_mm,
-	.release	= release_proc_mm,
-	.write		= write_proc_mm,
-};
-
-static int make_proc_mm(void)
-{
-	struct proc_dir_entry *ent;
-
-	ent = create_proc_entry("mm", 0222, &proc_root);
-	if(ent == NULL){
-		printk("make_proc_mm : Failed to register /proc/mm\n");
-		return(0);
-	}
-	ent->proc_fops = &proc_mm_fops;
-
-	return(0);
-}
-
-__initcall(make_proc_mm);
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */

diff -puN mm/shmem.c~remove-devanon-skas mm/shmem.c

mm/shmem.c renamed from mm/shmem.c~remove-devanon-skas +6 -143
@@ -128,17 +128,16 @@ static void shmem_removepage(struct page
 * 	      	       +-> 48-51
 * 	      	       +-> 52-55
 */
-static void *shmem_block(unsigned long index, unsigned long *page,
-			 unsigned long *direct, void ***indirect)
+static swp_entry_t *shmem_swp_entry(struct shmem_inode_info *info, unsigned long index, unsigned long *page)
 {
 	unsigned long offset;
 	void **dir;
 
 	if (index < SHMEM_NR_DIRECT)
-		return direct+index;
-	if (!*indirect) {
+		return info->i_direct+index;
+	if (!info->i_indirect) {
 		if (page) {
-			*indirect = (void **) *page;
+			info->i_indirect = (void **) *page;
 			*page = 0;
 		}
 		return NULL;			/* need another page */
@@ -147,7 +146,7 @@ static void *shmem_block(unsigned long i
 	index -= SHMEM_NR_DIRECT;
 	offset = index % ENTRIES_PER_PAGE;
 	index /= ENTRIES_PER_PAGE;
-	dir = *indirect;
+	dir = info->i_indirect;
 
 	if (index >= ENTRIES_PER_PAGE/2) {
 		index -= ENTRIES_PER_PAGE/2;
@@ -170,21 +169,7 @@ static void *shmem_block(unsigned long i
 		*dir = (void *) *page;
 		*page = 0;
 	}
-	return (unsigned long **) *dir + offset;
-}
-
-static swp_entry_t *shmem_swp_entry(struct shmem_inode_info *info, unsigned long index, unsigned long *page)
-{
-	return((swp_entry_t *) shmem_block(index, page,
-					   (unsigned long *) info->i_direct,
-					   &info->i_indirect));
-}
-
-static unsigned long *shmem_map_count(struct shmem_inode_info *info,
-				      unsigned long index, unsigned long *page)
-{
-	return((unsigned long *) shmem_block(index, page, info->map_direct,
-					     &info->map_indirect));
+	return (swp_entry_t *) *dir + offset;
 }
 
 /*
@@ -862,7 +847,6 @@ static int shmem_mmap(struct file *file,
 	ops = &shmem_vm_ops;
 	if (!S_ISREG(inode->i_mode))
 		return -EACCES;
-
 	UPDATE_ATIME(inode);
 	vma->vm_ops = ops;
 	return 0;
@@ -1752,125 +1736,4 @@ int shmem_zero_setup(struct vm_area_stru
 	return 0;
 }
 
-static int adjust_map_counts(struct shmem_inode_info *info,
-			     unsigned long offset, unsigned long len,
-			     int adjust)
-{
-	unsigned long idx, i, *count, page = 0;
-
-	spin_lock(&info->lock);
-	offset >>= PAGE_SHIFT;
-	len >>= PAGE_SHIFT;
-	for(i = 0; i < len; i++){
-		idx = (i + offset) >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
-
-		while((count = shmem_map_count(info, idx, &page)) == NULL){
-			spin_unlock(&info->lock);
-			page = get_zeroed_page(GFP_KERNEL);
-			if(page == 0)
-				return(-ENOMEM);
-			spin_lock(&info->lock);
-		}
-
-		if(page != 0)
-			free_page(page);
-
-		*count += adjust;
-	}
-	spin_unlock(&info->lock);
-	return(0);
-}
-
 EXPORT_SYMBOL(shmem_file_setup);
-
-struct file_operations anon_file_operations;
-
-static int anon_mmap(struct file *file, struct vm_area_struct *vma)
-{
-        struct file *new;
-	struct inode *inode;
-	loff_t size = vma->vm_end - vma->vm_start;
-	int err;
-
-	if(file->private_data == NULL){
-	        new = shmem_file_setup("dev/anon", size);
-		if(IS_ERR(new))
-			return(PTR_ERR(new));
-
-		new->f_op = &anon_file_operations;
-		file->private_data = new;
-	}
-
-	if (vma->vm_file)
-		fput(vma->vm_file);
-	vma->vm_file = file->private_data;
-	get_file(vma->vm_file);
-
-	inode = vma->vm_file->f_dentry->d_inode;
-	err = adjust_map_counts(SHMEM_I(inode), vma->vm_pgoff, size, 1);
-	if(err)
-		return(err);
-
-	vma->vm_ops = &shmem_vm_ops;
-	return 0;
-}
-
-static void anon_munmap(struct file *file, struct vm_area_struct *vma,
-			unsigned long start, unsigned long len)
-{
-	struct inode *inode = file->f_dentry->d_inode;
-	struct shmem_inode_info *info = SHMEM_I(inode);
-	pgd_t *pgd;
-	pmd_t *pmd;
-	pte_t *pte;
-	struct page *page;
-	unsigned long addr, idx, *count;
-
-	for(addr = start; addr < start + len; addr += PAGE_SIZE){
-		idx = (addr - vma->vm_start + vma->vm_pgoff);
-		idx >>= PAGE_CACHE_SHIFT;
-
-		count = shmem_map_count(info, idx, NULL);
-		BUG_ON(count == NULL);
-
-		(*count)--;
-		if(*count > 0)
-			continue;
-
-		pgd = pgd_offset(vma->vm_mm, addr);
-		if(pgd_none(*pgd))
-			continue;
-
-		pmd = pmd_offset(pgd, addr);
-		if(pmd_none(*pmd))
-			continue;
-
-		pte = pte_offset(pmd, addr);
-		if(!pte_present(*pte)) /* XXX need to handle swapped pages */
-			continue;
-
-		*pte = pte_mkclean(*pte);
-
-		page = pte_page(*pte);
-		LockPage(page);
-		lru_cache_del(page);
-		ClearPageDirty(page);
-		remove_inode_page(page);
-		UnlockPage(page);
-
-		page_cache_release(page);
-	}
-}
-
-int anon_release(struct inode *inode, struct file *file)
-{
-	if(file->private_data != NULL)
-		fput(file->private_data);
-	return(0);
-}
-
-struct file_operations anon_file_operations = {
-	.mmap		= anon_mmap,
-	.munmap 	= anon_munmap,
-	.release	= anon_release,
-};

diff -puN arch/um/config.in~remove-devanon-skas arch/um/config.in

arch/um/config.in renamed from arch/um/config.in~remove-devanon-skas +0 -0
@@ -52,7 +52,6 @@ fi

int 'Nesting level' CONFIG_NEST_LEVEL 0
int 'Kernel address space size (in .5G units)' CONFIG_KERNEL_HALF_GIGS 1 bool 'Highmem support' CONFIG_HIGHMEM
-bool '/proc/mm' CONFIG_PROC_MM
int 'Kernel stack size order' CONFIG_KERNEL_STACK_ORDER 2 bool 'Real-time Clock' CONFIG_UML_REAL_TIME_CLOCK
endmenu
diff -puN arch/um/defconfig~remove-devanon-skas arch/um/defconfig

arch/um/defconfig renamed from arch/um/defconfig~remove-devanon-skas +0 -0
@@ -37,7 +37,6 @@ CONFIG_MAGIC_SYSRQ=y

CONFIG_NEST_LEVEL=0
CONFIG_KERNEL_HALF_GIGS=1
# CONFIG_HIGHMEM is not set
-CONFIG_PROC_MM=y
CONFIG_KERNEL_STACK_ORDER=2
CONFIG_UML_REAL_TIME_CLOCK=y

diff -puN arch/um/kernel/ptrace.c~remove-devanon-skas arch/um/kernel/ptrace.c

arch/um/kernel/ptrace.c renamed from arch/um/kernel/ptrace.c~remove-devanon-skas +0 -54
@@ -7,9 +7,6 @@
 #include "linux/mm.h"
 #include "linux/errno.h"
 #include "linux/smp_lock.h"
-#ifdef CONFIG_PROC_MM
-#include "linux/proc_mm.h"
-#endif
 #include "asm/ptrace.h"
 #include "asm/uaccess.h"
 #include "kern_util.h"
@@ -231,57 +228,6 @@ int sys_ptrace(long request, long pid, l
 		ret = set_fpxregs(data, child);
 		break;
 #endif
-	case PTRACE_FAULTINFO: {
-		struct ptrace_faultinfo fault;
-
-		fault = ((struct ptrace_faultinfo)
-			{ .is_write	= child->thread.err,
-			  .addr		= child->thread.cr2 });
-		ret = copy_to_user((unsigned long *) data, &fault,
-				   sizeof(fault));
-		if(ret)
-			break;
-		break;
-	}
-	case PTRACE_SIGPENDING:
-		ret = copy_to_user((unsigned long *) data,
-				   &child->pending.signal,
-				   sizeof(child->pending.signal));
-		break;
-
-	case PTRACE_LDT: {
-		struct ptrace_ldt ldt;
-
-		if(copy_from_user(&ldt, (unsigned long *) data,
-				  sizeof(ldt))){
-			ret = -EIO;
-			break;
-		}
-
-		/* This one is confusing, so just punt and return -EIO for
-		 * now
-		 */
-		ret = -EIO;
-		break;
-	}
-#ifdef CONFIG_PROC_MM
-	case PTRACE_SWITCH_MM: {
-		struct mm_struct *old = child->mm;
-		struct mm_struct *new = proc_mm_get_mm(data);
-
-		if(IS_ERR(new)){
-			ret = PTR_ERR(new);
-			break;
-		}
-
-		atomic_inc(&new->mm_users);
-		child->mm = new;
-		child->active_mm = new;
-		mmput(old);
-		ret = 0;
-		break;
-	}
-#endif
 	default:
 		ret = -EIO;
 		break;

diff -puN include/linux/mm.h~remove-devanon-skas include/linux/mm.h

include/linux/mm.h renamed from include/linux/mm.h~remove-devanon-skas +0 -3
@@ -517,9 +517,6 @@ extern int ptrace_check_attach(struct ta
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
 		int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
 
-extern long do_mprotect(struct mm_struct *mm, unsigned long start,
-			size_t len, unsigned long prot);
-
 /*
 * On a two-level page table, this ends up being trivial. Thus the
 * inlining and the symmetry break with pte_alloc() that does all

@@-567,10 +564,9 @@ extern void exit_mmap(struct mm_struct *

extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);

include/linux/mm.h renamed from include/linux/mm.h~remove-devanon-skas +3 -4
-extern unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file *file,
-				   unsigned long addr, unsigned long len,
-				   unsigned long prot, unsigned long flag,
-				   unsigned long pgoff);
+extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+	unsigned long len, unsigned long prot,
+	unsigned long flag, unsigned long pgoff);

static inline unsigned long do_mmap(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,

include/linux/mm.h renamed from include/linux/mm.h~remove-devanon-skas +1 -2
@@ -580,8 +576,7 @@ static inline unsigned long do_mmap(stru
 	if ((offset + PAGE_ALIGN(len)) < offset)
 		goto out;
 	if (!(offset & ~PAGE_MASK))
-		ret = do_mmap_pgoff(current->mm, file, addr, len, prot, flag,
-				    offset >> PAGE_SHIFT);
+		ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);

out:

Quoted 5 lines
	return ret;
}

_

--
db