From: Brian Gerst <bgerst@didntduck.org>
To: Ken Ashcraft <kash@Stanford.EDU>
Cc: linux-kernel@vger.kernel.org
Subject: Re: null pointer questions
Date: Fri, 02 Nov 2001 18:39:53 -0500 [thread overview]
Message-ID: <3BE32EC9.842913E6@didntduck.org> (raw)
In-Reply-To: <Pine.GSO.4.33.0111021433590.6907-100000@saga18.Stanford.EDU> <3BE32E24.E89E83CD@didntduck.org>
Brian Gerst wrote:
>
> Ken Ashcraft wrote:
> >
> > > > 2. What happens if I pass a null pointer as the destination parameter
> > > > to copy_from_user? Does copy_from_user handle it safely or will the
> > > > kernel seg fault?
> > >
> > > The kernel won't crash, but it might fail (depending on whether 0 is a
> > > valid user space address or not).
> >
> > Why does it matter if 0 is a valid user space or not? If I make the call
> >
> > copy_from_user(0, user_ptr, 4);
> >
> > the null pointer is the kernel address, not the user address. Can you
> > clarify please?
>
> copy_from_user uses the string move instruction on the x86, so the
> exception code would assume the source faulted not the dest. It would
> return -EFAULT instead of causing an oops.
Err, would return non-zero instead of -EFAULT.
--
Brian Gerst
prev parent reply other threads:[~2001-11-02 23:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-02 7:30 Ken Ashcraft
2001-11-02 12:51 ` Roman Zippel
2001-11-02 13:16 ` lkml user
2001-11-02 22:42 ` Ken Ashcraft
2001-11-02 23:20 ` Roman Zippel
2001-11-02 23:37 ` Brian Gerst
2001-11-02 23:39 ` Brian Gerst [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=3BE32EC9.842913E6@didntduck.org \
--to=bgerst@didntduck.org \
--cc=kash@Stanford.EDU \
--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 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®