linux-um archives
 help / color / mirror / Atom feed
From: Nikita Danilov <Nikita@Namesys.COM>
To: Andrew Morton <AKPM@Osdl.ORG>
Cc: Jeff Dike <JDike@Karaya.COM>,
	user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Re: [PATCH]: fix UML compilation breakage in fs/proc/task_mmu.c
Date: Fri, 9 Jan 2004 16:16:01 +0300	[thread overview]
Message-ID: <16382.43409.661706.120605@laputa.namesys.com> (raw)
In-Reply-To: <16381.46954.397526.967308@laputa.namesys.com>

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

      reply	other threads:[~2004-01-09 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16382.43409.661706.120605@laputa.namesys.com \
    --to=nikita@namesys.com \
    --cc=AKPM@Osdl.ORG \
    --cc=JDike@Karaya.COM \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox