Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3919176imm; Mon, 4 Jun 2018 11:27:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLEZqbj5fg5KCvoQWKxtzD1nP9EZvDQuNJvj/xdAvIcoEdxuq5TGe/0pz5ClROm3rggvf6Z X-Received: by 2002:a65:6252:: with SMTP id q18-v6mr12881898pgv.106.1528136828388; Mon, 04 Jun 2018 11:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528136828; cv=none; d=google.com; s=arc-20160816; b=HYxPaw0Sec/FPY3n5UORKpdol8MTuIO0DpMvV+fzWzojMMtS2bpRLoNC78zIliZMyc AhCF1gnn4JKvaY+xhC5MGHFzdAjdeOEWZV8vP1oWjqmFXUjnd7A7OhNgLdR9G2K/2Gyo 9n+uLmiWKn07udN5SPIlUGWxGlVGNfasGNaOgP2huFC49jFMnQsrSQNeIl8Vg0nCxIc4 lFwi6QaUajHd8hsVCkkHcxOb12LvOe72Eh2F6uoUHxGYwCMpp9GeT+lnsp3ytIisEKqL 19YV1qBrJ4GrGPoRu3DTTztRAmiGr2wepfv/SE+Wq9GyDT1RVB5obgDzSmZsJ+o4MnbI lh1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=9jHnw9E3r5R40H6pgvkIRsUV6OJNBtGWtKP72W5NLBo=; b=XrO07WErSQjti0lmpr50ykK3IwYKPVd3vb76iqBxThjY+d3DaOHbu4SIXZqIskvi2Z N3DjBHG6RCQ1EsMhZrsHUtno4TytWy1lKE4dkEPAS3RV5iOELFdwCHzAxv+hNTecXMIi al8/+uWlz6JqM7TKsb+6wU4iQXlm1U6wAkVO8+grWDe2qSozbAlLDv31nnNnC6k/uY/K kjpljKZ2daRGduow/BrsaaeSpvZ9wn1NQ2Za3HoHkBPyASmZpkK9psawX948kKgaq9qe vt3lnMIxNILYyzjavNDV6pVuDCbqSOFd0B2+TpZBqQFKsmcv2O8FAvnG0e2rwogNU2pp LeDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=GK+Oha+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10-v6si45836784plv.1.2018.06.04.11.26.53; Mon, 04 Jun 2018 11:27:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=GK+Oha+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751430AbeFDSYt (ORCPT + 99 others); Mon, 4 Jun 2018 14:24:49 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34422 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751401AbeFDSYr (ORCPT ); Mon, 4 Jun 2018 14:24:47 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w54INhUO109376; Mon, 4 Jun 2018 18:24:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=9jHnw9E3r5R40H6pgvkIRsUV6OJNBtGWtKP72W5NLBo=; b=GK+Oha+Rbm0u1/Rv3byovyUlIitfjhOb6A4NceRcWF/3opnJjzuOrZHSJj9jTGl5w4Uq aiWYaBiCfK6B+Ux0BsuNhIBlwNzbR8ThDjx5XDfDM2kcbdVk4AGRNYKMqkQTpFLA0CCj Ksk4z0K3zQwTT2egYFeK9hwxBwCLWtxwzZw03/Xm3OQNOsINRwsoN2H9N+Y3Q3bhXBz3 W/cl/FTZh7y1Lkl2/j61c6rpFNZhAFEHPSkyftZmxwPeEjTAkmyMU2xz91NlNHe+BhcE 0wridXRoG98F5gbkdoN2M+7BZIXZSsYfBpSW6WajXwC/+Pzc89o8GYfAjNYRJAjrX6VT yw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2jbvypcrmv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Jun 2018 18:24:36 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w54IOaEC011088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Jun 2018 18:24:36 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w54IOZY0025992; Mon, 4 Jun 2018 18:24:35 GMT Received: from [192.168.1.93] (/99.156.91.244) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Jun 2018 11:24:35 -0700 Subject: Re: Slab out of bounds in setxattr To: shankarapailoor Cc: jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org References: From: Dave Kleikamp Openpgp: preference=signencrypt Message-ID: <2f2047ca-a96f-91da-c746-530c7b8d1bbf@oracle.com> Date: Mon, 4 Jun 2018 13:24:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8914 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=697 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040211 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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 > > >