linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kasatkin, Dmitry" <dmitry.kasatkin@intel.com>
To: Peter Jones <pjones@redhat.com>
Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC 1/2] export unpack_to_rootfs
Date: Fri, 8 Feb 2013 10:30:43 +0200	[thread overview]
Message-ID: <CALLzPKZ5UJFRvEYL4C=XAExqnsvvv5zudD6tj_vOYs5ix1DbGQ@mail.gmail.com> (raw)
In-Reply-To: <CALLzPKYLqR-rXyf4FFQpo31tTNsKm1=gyfeVi==LPqV6qX8jSw@mail.gmail.com>

On Tue, Feb 5, 2013 at 7:16 PM, Kasatkin, Dmitry
<dmitry.kasatkin@intel.com> wrote:
> On Tue, Feb 5, 2013 at 6:48 PM, Peter Jones <pjones@redhat.com> wrote:
>> On Tue, Feb 05, 2013 at 02:34:49PM +0200, Dmitry Kasatkin wrote:
>>> Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
>>> ---
>>>  init/do_mounts.h |    2 ++
>>>  init/initramfs.c |    2 +-
>>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/init/do_mounts.h b/init/do_mounts.h
>>> index f5b978a..11829eb 100644
>>> --- a/init/do_mounts.h
>>> +++ b/init/do_mounts.h
>>> @@ -74,3 +74,5 @@ void md_run_setup(void);
>>>  static inline void md_run_setup(void) {}
>>>
>>>  #endif
>>> +
>>> +char * __init unpack_to_rootfs(char *buf, unsigned len);
>>> diff --git a/init/initramfs.c b/init/initramfs.c
>>> index 84c6bf1..e32bc06 100644
>>> --- a/init/initramfs.c
>>> +++ b/init/initramfs.c
>>> @@ -421,7 +421,7 @@ static unsigned my_inptr;   /* index of next byte to be processed in inbuf */
>>>
>>>  #include <linux/decompress/generic.h>
>>>
>>> -static char * __init unpack_to_rootfs(char *buf, unsigned len)
>>> +char * __init unpack_to_rootfs(char *buf, unsigned len)
>>>  {
>>>       int written, res;
>>>       decompress_fn decompress;
>>
>> Doing this unconditionally seems to be inviting rootkit authors to use a
>> new and shiny tool.  I also don't think it's the best way to do this,
>> but I'll comment on the other patch to explain why.
>>
>

Just wanted to point out, that there is no chance for rootkits in
anyway because of this:

1) "rootkits" can have unpacking functionality inside, but if they are so lazy
2) unpack_to_rootfs() is not EXPORT_SYMBOLed.
3) and more over, unpack_to_rootfs() is "__init" and is freed before
main initramfs or rootfs init is executed.

- Dmitry

> Sorry for re-post, but answering from mobile was in HTML and it was blocked.
> Modifying an initramfs gives the same opportunity during boot only.
> But agreed, it might be the part of the primary source code. It was
> very to do it in this way to implement and test a solution.
>
> Thanks.
>
>> --
>>         Peter

  reply	other threads:[~2013-02-08  8:30 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 12:34 [RFC 0/2] initramfs with digital signature protection Dmitry Kasatkin
2013-02-05 12:34 ` [RFC 1/2] export unpack_to_rootfs Dmitry Kasatkin
2013-02-05 16:48   ` Peter Jones
2013-02-05 17:16     ` Kasatkin, Dmitry
2013-02-08  8:30       ` Kasatkin, Dmitry [this message]
2013-02-05 12:34 ` [RFC 2/2] initramfs with digital signature protection Dmitry Kasatkin
2013-02-05 18:03   ` Peter Jones
2013-02-05 20:08     ` Mimi Zohar
2013-02-05 22:03     ` Kasatkin, Dmitry
2013-02-05 18:19   ` Matthew Garrett
2013-02-05 18:30     ` Matthew Garrett
2013-02-05 18:34     ` Vivek Goyal
2013-02-05 21:55       ` Kasatkin, Dmitry
2013-04-05 13:50         ` Vivek Goyal
2013-04-08 19:43           ` Mimi Zohar
2013-04-08 20:09             ` Vivek Goyal
2013-04-08 20:17               ` Josh Boyer
2013-04-09 14:38                 ` Vivek Goyal
2013-04-10  3:07                   ` Mimi Zohar
2013-04-10 19:42                     ` Vivek Goyal
2013-04-10 21:05                       ` Mimi Zohar
2013-04-11  8:08                         ` Dmitry Kasatkin
2013-04-11 14:52                         ` Vivek Goyal
2013-04-12 11:54                           ` Mimi Zohar
     [not found]                         ` <CACE9dm-GZpjco8u6jNxLQpYA8LYSeoVjsyyRXVwxXHzjO-LvGw@mail.gmail.com>
2013-04-11 14:55                           ` Vivek Goyal
2013-04-11 18:42                             ` Dmitry Kasatkin
2013-04-11 21:13                               ` Vivek Goyal
2013-04-12 12:03                                 ` Mimi Zohar
2013-02-05 20:36   ` Peter Jones
2013-02-05 22:09     ` Kasatkin, Dmitry
2013-02-06  5:04       ` H. Peter Anvin
2013-02-06  8:01         ` Kasatkin, Dmitry
2013-02-06 16:41           ` H. Peter Anvin
2013-02-08  9:16             ` Kasatkin, Dmitry
2013-02-08 15:49               ` H. Peter Anvin
2013-02-08 16:24                 ` Kasatkin, Dmitry
2013-02-08 16:50                   ` H. Peter Anvin
2013-02-07 17:05   ` Vivek Goyal
2013-02-08  8:34     ` Kasatkin, Dmitry
2013-02-08 13:27       ` Kasatkin, Dmitry
2013-02-11 21:59         ` Vivek Goyal

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='CALLzPKZ5UJFRvEYL4C=XAExqnsvvv5zudD6tj_vOYs5ix1DbGQ@mail.gmail.com' \
    --to=dmitry.kasatkin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=pjones@redhat.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;
as well as URLs for NNTP newsgroup(s).