mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wind@cocodriloo.com
To: wind-lkml@cocodriloo.com
Cc: Marc-Christian Petersen <m.c.p@wolk-project.de>,
	Alex Tomas <bzzz@tmi.comex.ru>,
	riel@surriel.com, akpm@digeo.com, linux-kernel@vger.kernel.org
Subject: Re: 2.4 vm, program load, page faulting, ...
Date: Mon, 17 Mar 2003 20:34:11 +0100	[thread overview]
Message-ID: <20030317193411.GE11526@wind.cocodriloo.com> (raw)
In-Reply-To: <20030317190636.GD11526@wind.cocodriloo.com>

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

On Mon, Mar 17, 2003 at 08:06:36PM +0100, wind-lkml@cocodriloo.com wrote:
> On Mon, Mar 17, 2003 at 07:57:49PM +0100, Marc-Christian Petersen wrote:
> > On Monday 17 March 2003 18:38, wind-lkml@cocodriloo.com wrote:
> > 
> > Hi Wind,
> > 
> > > > I wonder if this could be done by walking and faulting
> > > > all pages at fs/binfmt_elf.c::elf_map just after do_mmap...
> > > > will try it just now :)
> > >
> > > OK, this is not tested, since I'm compiling it now... feel free
> > > to correct :)
> > 
> > mm/mmap.c:
> > 
> > unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned 
> > long len,
> >         unsigned long prot, unsigned long flags, unsigned long pgoff)
> > {
> > 
> > your "do_mmap_pgoff" calls 7 arguments. Obviously it cannot compile 8-)
> > 
> 
> My first patch, I'm just becoming intimate with printk ;)

OK, so I took a different approach, and just called handle_mm_fault just
like if there had been user-level accesses to the file.

Applied on 2.5.63-uml1 and booted debian woody with it.

Can any of you try it on a real machine? (I dont have a test machine :(

Greets, Antonio.


[-- Attachment #2: prefault.patch --]
[-- Type: text/plain, Size: 879 bytes --]

--- orig/fs/binfmt_elf.c	Mon Mar 17 20:30:17 2003
+++ work/fs/binfmt_elf.c	Mon Mar 17 20:30:29 2003
@@ -259,12 +259,26 @@ create_elf_tables(struct linux_binprm *b
 static inline unsigned long
 elf_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
 {
-	unsigned long map_addr;
+	struct mm_struct *mm;
+	struct vm_area_struct *vma;
+	unsigned long map_addr, n;
 
 	down_write(&current->mm->mmap_sem);
 	map_addr = do_mmap(filep, ELF_PAGESTART(addr),
 			   eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr), prot, type,
 			   eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr));
+
+
+	addr = ELF_PAGESTART(addr);
+	mm = current->mm;
+	vma = find_vma(mm, addr);
+	if(!vma)
+		goto out;
+
+	for(n = 0; n < eppnt->p_filesz; n+=PAGE_SIZE)
+		handle_mm_fault(mm, vma, addr + n, 0);
+
+out:
 	up_write(&current->mm->mmap_sem);
 	return(map_addr);
 }

  reply	other threads:[~2003-03-17 19:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-16  4:59 Paul Albrecht
2003-03-17 15:02 ` Rik van Riel
2003-03-17 15:10   ` William Lee Irwin III
2003-03-17 16:01     ` Rik van Riel
2003-03-17 16:52       ` wind
2003-03-17 16:50         ` Alex Tomas
2003-03-17 17:12           ` wind-lkml
2003-03-17 17:38             ` wind-lkml
2003-03-17 18:57               ` Marc-Christian Petersen
2003-03-17 19:06                 ` wind-lkml
2003-03-17 19:34                   ` wind [this message]
2003-03-17 22:05           ` Andrew Morton
2003-03-17 23:08             ` wind
2003-03-17 23:28               ` Andrew Morton
2003-03-18  0:12                 ` wind
2003-03-17 16:37     ` Alex Tomas
2003-03-18  7:43   ` Paul Albrecht

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=20030317193411.GE11526@wind.cocodriloo.com \
    --to=wind@cocodriloo.com \
    --cc=akpm@digeo.com \
    --cc=bzzz@tmi.comex.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.c.p@wolk-project.de \
    --cc=riel@surriel.com \
    --cc=wind-lkml@cocodriloo.com \
    /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

all inboxes | Powered by JetHome®