public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module: prevent warning when finit_module a 0 sized file
Date: Mon, 07 Jan 2013 11:20:16 +1030	[thread overview]
Message-ID: <87k3rp4y0n.fsf@rustcorp.com.au> (raw)
In-Reply-To: <50E602D4.8020604@oracle.com>

Sasha Levin <sasha.levin@oracle.com> writes:
> On 01/02/2013 07:41 PM, Rusty Russell wrote:
>> Sasha Levin <sasha.levin@oracle.com> writes:
>> 
>>> If we try to finit_module on a file sized 0 bytes vmalloc will
>>> scream and spit out a warning.
>>>
>>> Since modules have to be bigger than 0 bytes anyways we can just
>>> check that beforehand and avoid the warning.
>> 
>> Applied, but I added the comment you somehow missed :)
>
> Thanks!
>
> I do have a somewhat related follow-up question:
>
> When init_module() goes through the module loading process, it will try to vmalloc()
> whatever size passed to it by the user, which may cause vmalloc() to scream and shout
> if the size passed from userspace is too big.
>
> Do you think that reading just the header and doing a quick elf_header_check() on
> it before trying to read the entire file would make sense here?

No.  Root asked, we do.  If modprobe wants to check the header, let it.

Cheers,
Rusty.

      reply	other threads:[~2013-01-07  1:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28 19:27 [PATCH] module: prevent warning when finit_module a 0 sized file Sasha Levin
2013-01-03  0:41 ` Rusty Russell
2013-01-03 22:14   ` Sasha Levin
2013-01-07  0:50     ` Rusty Russell [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=87k3rp4y0n.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.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