linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [PATCH]: fix UML compilation breakage in fs/proc/task_mmu.c
@ 2004-01-08 20:02 Nikita Danilov
  2004-01-09 13:16 ` [uml-devel] " Nikita Danilov
  0 siblings, 1 reply; 2+ messages in thread
From: Nikita Danilov @ 2004-01-08 20:02 UTC (permalink / raw)
  To: Jeff Dike; +Cc: user-mode-linux-devel, Andrew Morton

Hello,

recent change that adds fixmaps to the /proc/<pid>/maps broke
compilation on the UML, because there FIXADDR_USER_{START,END} are not
constant.

This patch adds a function to initialize &gate_vmarea.

Nikita.
diff -puN fs/proc/task_mmu.c~uml-FIXADDR_USER_START-not-const fs/proc/task_mmu.c
--- lobby/fs/proc/task_mmu.c~uml-FIXADDR_USER_START-not-const	Thu Jan  8 20:56:36 2004
+++ lobby-nikita/fs/proc/task_mmu.c	Thu Jan  8 20:56:36 2004
@@ -79,17 +79,27 @@ int task_statm(struct mm_struct *mm, int
 #ifdef AT_SYSINFO_EHDR
 
 static struct vm_area_struct gate_vmarea = {
-	/* Do _not_ mark this area as readable, cuz not the entire range may be readable
-	   (e.g., due to execute-only pages or holes) and the tools that read
-	   /proc/PID/maps should read the interesting bits from the gate-DSO file
-	   instead.  */
-	.vm_start = FIXADDR_USER_START,
-	.vm_end = FIXADDR_USER_END
+	/*
+	 * we cannot initialize fields right here, because on some
+	 * architectures (on UML to be precise), FIXADDR_USER_* are not
+	 * constant. See build_gate_map() below.
+	 */
 };
 
 # define gate_map()	&gate_vmarea
+static inline struct vm_area_struct *build_gate_map(void)
+{
+	/* Do _not_ mark this area as readable, cuz not the entire range may
+	   be readable (e.g., due to execute-only pages or holes) and the
+	   tools that read /proc/PID/maps should read the interesting bits
+	   from the gate-DSO file instead.  */
+	gate_vmarea.vm_start = FIXADDR_USER_START;
+	gate_vmarea.vm_end   = FIXADDR_USER_END;
+	return &gate_vmarea;
+}
 #else
 # define gate_map()	NULL
+# define build_gate_map()	NULL
 #endif
 
 static int show_map(struct seq_file *m, void *v)
@@ -146,7 +156,7 @@ static void *m_start(struct seq_file *m,
 		up_read(&mm->mmap_sem);
 		mmput(mm);
 		if (l == -1)
-			map = gate_map();
+			map = build_gate_map();
 	}
 	return map;
 }

_



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [uml-devel] Re: [PATCH]: fix UML compilation breakage in fs/proc/task_mmu.c
  2004-01-08 20:02 [uml-devel] [PATCH]: fix UML compilation breakage in fs/proc/task_mmu.c Nikita Danilov
@ 2004-01-09 13:16 ` Nikita Danilov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikita Danilov @ 2004-01-09 13:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jeff Dike, user-mode-linux-devel

Hopefully correct version this time. In previous version it was possible
to call ->show() on non-initialized gate_vmarea (through m_next()). Just
call build_gate_map() at the beginning of the m_start().

At least now it works:

$ cat /proc/self/maps | tail -1
ffffe000-fffff000 ---p 00000000 00:00 0 

I am not sure that this is best solution, because some utilities seems
to use /proc/*/maps extensively. Probably initialization should be moved
into initcall.

Nikita.
diff -puN fs/proc/task_mmu.c~uml-FIXADDR_USER_START-not-const fs/proc/task_mmu.c
--- limbo/fs/proc/task_mmu.c~uml-FIXADDR_USER_START-not-const	Fri Jan  9 16:05:37 2004
+++ limbo-god/fs/proc/task_mmu.c	Fri Jan  9 16:06:39 2004
@@ -79,17 +79,26 @@ int task_statm(struct mm_struct *mm, int
 #ifdef AT_SYSINFO_EHDR
 
 static struct vm_area_struct gate_vmarea = {
-	/* Do _not_ mark this area as readable, cuz not the entire range may be readable
-	   (e.g., due to execute-only pages or holes) and the tools that read
-	   /proc/PID/maps should read the interesting bits from the gate-DSO file
-	   instead.  */
-	.vm_start = FIXADDR_USER_START,
-	.vm_end = FIXADDR_USER_END
+	/*
+	 * we cannot initialize fields right here, because on some
+	 * architectures (on UML to be precise), FIXADDR_USER_* are not
+	 * constant. See build_gate_map() below.
+	 */
 };
 
 # define gate_map()	&gate_vmarea
+static inline void build_gate_map(void)
+{
+	/* Do _not_ mark this area as readable, cuz not the entire range may
+	   be readable (e.g., due to execute-only pages or holes) and the
+	   tools that read /proc/PID/maps should read the interesting bits
+	   from the gate-DSO file instead.  */
+	gate_vmarea.vm_start = FIXADDR_USER_START;
+	gate_vmarea.vm_end   = FIXADDR_USER_END;
+}
 #else
 # define gate_map()	NULL
+# define build_gate_map()
 #endif
 
 static int show_map(struct seq_file *m, void *v)
@@ -138,6 +147,8 @@ static void *m_start(struct seq_file *m,
 	if (!mm)
 		return NULL;
 
+	build_gate_map();
+
 	down_read(&mm->mmap_sem);
 	map = mm->mmap;
 	while (l-- && map)

_


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-09 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-08 20:02 [uml-devel] [PATCH]: fix UML compilation breakage in fs/proc/task_mmu.c Nikita Danilov
2004-01-09 13:16 ` [uml-devel] " Nikita Danilov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox