All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@gentwo.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] slab: prevent warnings when allocating with __GFP_NOWARN
Date: Tue, 11 Jun 2013 09:16:19 -0400	[thread overview]
Message-ID: <51B72323.8040207@oracle.com> (raw)
In-Reply-To: <CAOJsxLH56xqCoDikYYaY_guqCX=S4rcVfDJQ4ki=r-PkNQW9ug@mail.gmail.com>

On 06/11/2013 02:28 AM, Pekka Enberg wrote:
> Hi Sasha,
>
> On Tue, Jun 11, 2013 at 3:54 AM, Sasha Levin <sasha.levin@oracle.com> wrote:
>> On 06/10/2013 07:40 PM, Christoph Lameter wrote:
>>>
>>> On Mon, 10 Jun 2013, Sasha Levin wrote:
>>>
>>>> [ 1691.807621] Call Trace:
>>>> [ 1691.809473]  [<ffffffff83ff4041>] dump_stack+0x4e/0x82
>>>> [ 1691.812783]  [<ffffffff8111fe12>] warn_slowpath_common+0x82/0xb0
>>>> [ 1691.817011]  [<ffffffff8111fe55>] warn_slowpath_null+0x15/0x20
>>>> [ 1691.819936]  [<ffffffff81243dcf>] kmalloc_slab+0x2f/0xb0
>>>> [ 1691.824942]  [<ffffffff81278d54>] __kmalloc+0x24/0x4b0
>>>> [ 1691.827285]  [<ffffffff8196ffe3>] ? security_capable+0x13/0x20
>>>> [ 1691.829405]  [<ffffffff812a26b7>] ? pipe_fcntl+0x107/0x210
>>>> [ 1691.831827]  [<ffffffff812a26b7>] pipe_fcntl+0x107/0x210
>>>> [ 1691.833651]  [<ffffffff812b7ea0>] ? fget_raw_light+0x130/0x3f0
>>>> [ 1691.835343]  [<ffffffff812aa5fb>] SyS_fcntl+0x60b/0x6a0
>>>> [ 1691.837008]  [<ffffffff8403ca98>] tracesys+0xe1/0xe6
>>>>
>>>> The caller specifically sets __GFP_NOWARN presumably to avoid this
>>>> warning on
>>>> slub but I'm not sure if there's any other reason.
>>>
>>>
>>> There must be another reason. Lets fix this.
>>
>> My, I feel silly now.
>>
>> I was the one who added __GFP_NOFAIL in the first place in
>> 2ccd4f4d ("pipe: fail cleanly when root tries F_SETPIPE_SZ
>> with big size").
>>
>> What happens is that root can go ahead and specify any size
>> it wants to be used as buffer size - and the kernel will
>> attempt to comply by allocation that buffer. Which fails
>> if the size is too big.
>>
>> Either way, even if we do end up doing something different,
>> shouldn't we prevent slab from spewing a warning if
>> __GFP_NOWARN is passed?
>
> Yeah, this is the size-from-userspace case I was thinking about. I think
> we have two options: either use your patch or drop the WARN_ON
> completely.
>
> Christoph, which one do you prefer?

I think that leaving the warning makes sense to catch similar
things which are actually bugs - we had a similar issue with
/dev/kmsg (if I remember correctly) which actually pointed to
a bug.


Thanks,
Sasha

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sasha.levin@oracle.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@gentwo.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] slab: prevent warnings when allocating with __GFP_NOWARN
Date: Tue, 11 Jun 2013 09:16:19 -0400	[thread overview]
Message-ID: <51B72323.8040207@oracle.com> (raw)
In-Reply-To: <CAOJsxLH56xqCoDikYYaY_guqCX=S4rcVfDJQ4ki=r-PkNQW9ug@mail.gmail.com>

On 06/11/2013 02:28 AM, Pekka Enberg wrote:
> Hi Sasha,
>
> On Tue, Jun 11, 2013 at 3:54 AM, Sasha Levin <sasha.levin@oracle.com> wrote:
>> On 06/10/2013 07:40 PM, Christoph Lameter wrote:
>>>
>>> On Mon, 10 Jun 2013, Sasha Levin wrote:
>>>
>>>> [ 1691.807621] Call Trace:
>>>> [ 1691.809473]  [<ffffffff83ff4041>] dump_stack+0x4e/0x82
>>>> [ 1691.812783]  [<ffffffff8111fe12>] warn_slowpath_common+0x82/0xb0
>>>> [ 1691.817011]  [<ffffffff8111fe55>] warn_slowpath_null+0x15/0x20
>>>> [ 1691.819936]  [<ffffffff81243dcf>] kmalloc_slab+0x2f/0xb0
>>>> [ 1691.824942]  [<ffffffff81278d54>] __kmalloc+0x24/0x4b0
>>>> [ 1691.827285]  [<ffffffff8196ffe3>] ? security_capable+0x13/0x20
>>>> [ 1691.829405]  [<ffffffff812a26b7>] ? pipe_fcntl+0x107/0x210
>>>> [ 1691.831827]  [<ffffffff812a26b7>] pipe_fcntl+0x107/0x210
>>>> [ 1691.833651]  [<ffffffff812b7ea0>] ? fget_raw_light+0x130/0x3f0
>>>> [ 1691.835343]  [<ffffffff812aa5fb>] SyS_fcntl+0x60b/0x6a0
>>>> [ 1691.837008]  [<ffffffff8403ca98>] tracesys+0xe1/0xe6
>>>>
>>>> The caller specifically sets __GFP_NOWARN presumably to avoid this
>>>> warning on
>>>> slub but I'm not sure if there's any other reason.
>>>
>>>
>>> There must be another reason. Lets fix this.
>>
>> My, I feel silly now.
>>
>> I was the one who added __GFP_NOFAIL in the first place in
>> 2ccd4f4d ("pipe: fail cleanly when root tries F_SETPIPE_SZ
>> with big size").
>>
>> What happens is that root can go ahead and specify any size
>> it wants to be used as buffer size - and the kernel will
>> attempt to comply by allocation that buffer. Which fails
>> if the size is too big.
>>
>> Either way, even if we do end up doing something different,
>> shouldn't we prevent slab from spewing a warning if
>> __GFP_NOWARN is passed?
>
> Yeah, this is the size-from-userspace case I was thinking about. I think
> we have two options: either use your patch or drop the WARN_ON
> completely.
>
> Christoph, which one do you prefer?

I think that leaving the warning makes sense to catch similar
things which are actually bugs - we had a similar issue with
/dev/kmsg (if I remember correctly) which actually pointed to
a bug.


Thanks,
Sasha


  reply	other threads:[~2013-06-11 13:16 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 19:18 [PATCH] slab: prevent warnings when allocating with __GFP_NOWARN Sasha Levin
2013-06-10 19:18 ` Sasha Levin
2013-06-10 19:31 ` Pekka Enberg
2013-06-10 19:31   ` Pekka Enberg
2013-06-10 19:56   ` Sasha Levin
2013-06-10 19:56     ` Sasha Levin
2013-06-10 23:40     ` Christoph Lameter
2013-06-10 23:40       ` Christoph Lameter
2013-06-11  0:54       ` Sasha Levin
2013-06-11  0:54         ` Sasha Levin
2013-06-11  6:28         ` Pekka Enberg
2013-06-11  6:28           ` Pekka Enberg
2013-06-11 13:16           ` Sasha Levin [this message]
2013-06-11 13:16             ` Sasha Levin
2013-06-11 15:14             ` Christoph Lameter
2013-06-11 15:14               ` Christoph Lameter
2013-06-11 15:16               ` Pekka Enberg
2013-06-11 15:16                 ` Pekka Enberg
2013-06-11 15:23                 ` Christoph Lameter
2013-06-11 15:23                   ` Christoph Lameter
2013-06-11 15:44                   ` Sasha Levin
2013-06-11 15:44                     ` Sasha Levin
2013-06-11 16:13                     ` Eric Dumazet
2013-06-11 16:13                       ` Eric Dumazet
2013-06-11 16:19                       ` Sasha Levin
2013-06-11 16:19                         ` Sasha Levin
2013-06-11 16:37                         ` Eric Dumazet
2013-06-11 16:37                           ` Eric Dumazet
2013-06-11 16:43                           ` Dave Jones
2013-06-11 16:43                             ` Dave Jones
2013-06-11 19:02                           ` Sasha Levin
2013-06-11 19:02                             ` Sasha Levin
2013-06-12 13:01                           ` Christoph Lameter
2013-06-12 13:01                             ` Christoph Lameter
2013-06-11 16:28                       ` Christoph Lameter
2013-06-11 16:28                         ` Christoph Lameter
2013-06-11 22:34                 ` Andrew Morton
2013-06-11 22:34                   ` Andrew Morton
2013-06-13  7:03                   ` Pekka Enberg
2013-06-13  7:03                     ` Pekka Enberg
2013-06-11 22:10               ` David Rientjes
2013-06-11 22:10                 ` David Rientjes
2013-06-11 15:08         ` Christoph Lameter
2013-06-11 15:08           ` Christoph Lameter

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=51B72323.8040207@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@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.