All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Michon <emmanuel_michon@realmagic.fr>
To: linux-kernel@vger.kernel.org
Subject: large copy_to_user fills only one page?
Date: 30 May 2002 16:36:22 +0200	[thread overview]
Message-ID: <7wofexu2hl.fsf@avalon.france.sdesigns.com> (raw)

Hi,

I'm working with linux-2.4.18, and writing some
trivial code to get from kernel a grabbed image working this way:

#define IMSIZE 350000

user mode runs:
u_p=malloc(IMSIZE);
ioctl(grabberfd,DOGRAB,u_p);
write *u_p to disk
free(u_p);

kernelmode runs:
case DOGRAB:
        char *u_p,*k_p;
        copy_from_user(u_p,arg,sizeof(char *));
        k_p=vmalloc(IMSIZE);
        kernelgrabs(k_p);
        copy_to_user(u_p,k_p,IMSIZE);
        vfree(k_p);
        break;

What I get actually is only 4K filled in userland, but copy_to_user
returns IMSIZE!

If I memset the memory area *u_p to any value, the grab happens
properly.

I guess memset'ing faults the good pages in, I'm quite surprised
this does not happen smoothly by itself ;-( 

Any clue?

Sincerely yours,

-- 
Emmanuel Michon
Chef de projet
REALmagic France SAS
Mobile: 0614372733 GPGkeyID: D2997E42  

             reply	other threads:[~2002-05-30 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-30 14:36 Emmanuel Michon [this message]
2002-05-30 15:16 ` large copy_to_user fills only one page? Andi Kleen
2002-05-30 15:25 ` Ingo Oeser

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=7wofexu2hl.fsf@avalon.france.sdesigns.com \
    --to=emmanuel_michon@realmagic.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.