From: Sam Ravnborg <sam@ravnborg.org>
To: linux-kernel@vger.kernel.org
Subject: sparse warnings in initramfs - question?
Date: Mon, 8 Aug 2005 22:57:54 +0200 [thread overview]
Message-ID: <20050808205754.GA26770@mars.ravnborg.org> (raw)
I decided to take a closer look at initramfs after playing around with
klibc for a while.
When I ran sparse on it I received a lot of address space warnings like
this:
init/initramfs.c:234:21: warning: incorrect type in argument 1 (different address spaces)
init/initramfs.c:234:21: expected char const [noderef] *oldname<asn:1>
init/initramfs.c:234:21: got char *old
init/initramfs.c:234:26: warning: incorrect type in argument 2 (different address spaces)
init/initramfs.c:234:26: expected char const [noderef] *newname<asn:1>
init/initramfs.c:234:26: got char *static [toplevel] [assigned] collected
Several more of the same type followed. They were all rasied due to
pointers supplied to sys_* function properly marked with __user.
In the above case we see a call to:
sys_link(old, collected)
And neither old, not collected is marked __user.
So I looked at how they are assinged.
collected is assigned in read_info at line 142.
It is assigned a value stored in victim.
victim is assigned a value in write_buffer in line 312, assinged from
buf wich is a parameter to the function flush_buffer and
unpack_to_rootfs.
Following flush_buffer I see that flush_buffer is called with the global
variable window as parameter. window is assigned the value of a
malloc'ed buffer in unpack_to_rootfs - so window is not a __user
pointer.
Following the other track where write_buffer is used in unpack_to_rootfs
I see that buf is assinged a value equal __initramfs_start - a linker
defined symbol.
This may make a bit more sense, bt I'm not sure if this qualifies as a
_user pointer.
My basic question is if the various functions in namei is able to deal
with pointer that is not __user pointers?
I tried to follow and hit _strncpy_from_userspace, defined in
arch/i386/lib/usercopy.c. But in the end it was some inline assembler I
did not understand.
I would be gald if someone could sched some ligth on this matter -
thanks!
Sam
reply other threads:[~2005-08-08 20:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050808205754.GA26770@mars.ravnborg.org \
--to=sam@ravnborg.org \
--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®