From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: shankarapailoor <shankarapailoor@gmail.com>
Cc: jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: Slab out of bounds in setxattr
Date: Mon, 4 Jun 2018 13:39:37 -0500 [thread overview]
Message-ID: <d77a3fd9-ecda-1bf6-b4c9-60abdacd445a@oracle.com> (raw)
In-Reply-To: <CAB+yDaZFVpRGW8X_eN=0pEeujn6VX13kxRZSf-Sse_GrjcCQKA@mail.gmail.com>
On 06/04/2018 01:30 PM, shankarapailoor wrote:
> Hi Dave,
>
> Attached is my proposed patch. It solves the problem as you suggest
> and I don't see the KASAN complaint.
That looks good to me. Add a description and a Signed-off-by: and I'll
get it pushed upstream.
Thanks for finding this.
Shaggy
>
> Regards,
> Shankara
>
> On Mon, Jun 4, 2018 at 11:24 AM, Dave Kleikamp <dave.kleikamp@oracle.com> wrote:
>> On 06/01/2018 11:06 PM, shankarapailoor wrote:
>>> Hi,
>>>
>>> Looking at the crash some more, it seems that if value_len > PAGE_SIZE
>>> then e_buf->max_size is rounded up nearest page size [1]. If a new
>>> attribute is added with value_len < e_buf->max_size - EA_SIZE(ea) then
>>> no new space is allocated for the attiribute list [2] and this
>>> triggers the KASAN slab out of bounds error. This is the case in the C
>>> repro I provided.
>>
>> I see the problem. It looks like we should be calculating max_size
>> earlier and using that to call kmalloc(). (xattr.c#496)
>>
>> Shaggy
>>>
>>>
>>> 1. https://elixir.bootlin.com/linux/v4.17-rc7/source/fs/jfs/xattr.c#L501
>>> 2. https://elixir.bootlin.com/linux/v4.17-rc7/source/fs/jfs/xattr.c#L723
>>>
>>> On Fri, Jun 1, 2018 at 1:52 PM, shankarapailoor
>>> <shankarapailoor@gmail.com> wrote:
>>>> Hi Dave et al,
>>>>
>>>> I have been fuzzing linux 4.17-rc4 with JFS using Syzkaller KASAN:
>>>> slab-out-of-bounds in jfs_xattr.
>>>>
>>>> Attached are my kernel configs and a C reproducer. In the first
>>>> setxattr call it appears that length is much larger than the name. In
>>>> __jfs_setxattr, I don't see where the length is checked against the
>>>> actual value length.
>>>>
>>>> Regards,
>>>> Shankara Pailoor
next prev parent reply other threads:[~2018-06-04 18:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 20:52 shankarapailoor
2018-06-02 4:06 ` shankarapailoor
2018-06-04 18:24 ` Dave Kleikamp
2018-06-04 18:30 ` shankarapailoor
2018-06-04 18:39 ` Dave Kleikamp [this message]
2018-06-04 20:22 ` shankarapailoor
2018-06-04 20:25 ` shankarapailoor
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=d77a3fd9-ecda-1bf6-b4c9-60abdacd445a@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shankarapailoor@gmail.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
Powered by JetHome