Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2598610imu; Thu, 29 Nov 2018 07:26:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/WbWOuaMazCSlEjrP5ApC/4zkn7up5hyECZNhBNSM0nbcEqS9Fd66yY2BucRPEiXK0Yfp9O X-Received: by 2002:a63:a611:: with SMTP id t17mr1587694pge.338.1543505172210; Thu, 29 Nov 2018 07:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543505172; cv=none; d=google.com; s=arc-20160816; b=yHVMJBVwJlgmF2z6FdjPQlyQoJiLTegNS3ibMUMuu+kvFRaZQF2c3KeVVLjNGL7J0U +1b7Ds/Fc8PU/go2F0pnCPeQdauoPAgi7MtruYsCZG/KmuMzLD8mcbUFa+qEFiDfsFO9 xSN6Mz2Tt7JSrmo2e9x+Fjooi9/KKQoJZttB5b7GQHVTjpHBugCaPp2kUvKbBtP3Ph7p vR6ZM9/KW4ZJaSuE7MDzSLLNk6j35rZK2KdvUyWK9GT1JvWZVuP+X5TlErQnHszNeFhT pH67T0uHT+hwINh6OzTnp3VduJsjQo6iWn2UoVnsGscfJ/QRktUrOhV74f+XJJ7n8dAB V4/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fkTVqVtSHnQnnmSzPyfQ8OHgDTzl3EyPpvd/kiLSw1Y=; b=QIam1tDjvndhe8nx/Izn7eDNIEIzEAyPSJpBd2RdYj1atUaYJFcr4OWMrTw11Uy9ba V5ld2a4uzop+4yfQ6lnVze2+BxIokFvE2lnzgJapiwPyHEJYVBCbcxLhKO4pRn0sfNxW /J8uCtfr8oHdnEHUW0otQztFejY/mlyU3Jm/beEItBSI/KNZHq0d70gS+mtKYGXb+zMU fcl5/Q6fZD6HGn6XcbYHnKeuNC4zYUF6buU66nv0eniETgLC99ycf2shlAbu1vCpvfDI bfhMtLqK3flbk/GMNqbjHmiwNwFDRcFupecx8jYRP/igsU86nhhYCbV7fGRIbDkE54eg YZJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G3kDpXjP; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si2538667ply.409.2018.11.29.07.25.47; Thu, 29 Nov 2018 07:26:12 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=G3kDpXjP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728866AbeK3C26 (ORCPT + 99 others); Thu, 29 Nov 2018 21:28:58 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36059 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbeK3C26 (ORCPT ); Thu, 29 Nov 2018 21:28:58 -0500 Received: by mail-wm1-f65.google.com with SMTP id a18so2656574wmj.1; Thu, 29 Nov 2018 07:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fkTVqVtSHnQnnmSzPyfQ8OHgDTzl3EyPpvd/kiLSw1Y=; b=G3kDpXjPzrxTGg1sMOMsklW+LUvJ2LcjvQ5oZQCmEl72UaNX2efqmpJUGbCJDhqT78 V4ogKkWiEZ4K7m/X6SWhmF6BvBqYhCnGbevYREZXgKYx79+/Sle47ef5Y3JvNKjq4wSo CZCVpGiB3SUEeRBWOR7piQUvKx3SoQeGfBfqo75vIaTHmS/za5RHWlfwCPG1lq5R1Fak nJ5isSQH7/2FN1QHRmX3FIskHdjOPBls53heOr4nqXPCG6APUdiH+MURMzN+7c4upbhG FNtHvyQueYdowyPSo8k9xVDMRd5x18Mfab/2bGh981VJzOqC5Wg6l8fYeGJW0c8+9fej B1gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fkTVqVtSHnQnnmSzPyfQ8OHgDTzl3EyPpvd/kiLSw1Y=; b=afCVJOaB2PTOIsF5A+a99W2HSQh8dKdzp5vdipOEStOzlfEiEoq4iYn2/yVsW7EYx9 CeQN53bNz2tstjEw6VUJP98lSrs/dDW83dzTq11An+841VbDddJCuPvKLCPtxShhFBQH zu/A/EU0AY8SQt3w/R0lm2BxtLfrF2ngHfpvAe8cjaq4zG+kvdbaT8O9bnVHpbs0Ey7H 1XEcuV2NJKeBFj8+cb13fjCKD+bcFX/zEle0wrkUQuShkYJpOjGDn8/T7UurC2+r3dFI q/WogUUqhyng16HtWKb1h0yzI/jEZAd9jGff2IpT4bMfdBBVxqwooCj8PpJZ4QKxQDkj yxdg== X-Gm-Message-State: AA+aEWbM4f6pL1lU8EjjXVqDiKqrktnTwuB/9b7TrtSIUIAnbII62LHw BiJkK2W/H0Qxt/LgZCbQyInZl6Mc20V2iVD0se8EUJHi X-Received: by 2002:a1c:6508:: with SMTP id z8mr2190938wmb.28.1543504992163; Thu, 29 Nov 2018 07:23:12 -0800 (PST) MIME-Version: 1.0 References: <20181129135921.231283053@linuxfoundation.org> <20181129135922.602882966@linuxfoundation.org> In-Reply-To: <20181129135922.602882966@linuxfoundation.org> From: Tigran Aivazian Date: Thu, 29 Nov 2018 15:23:00 +0000 Message-ID: Subject: Re: [PATCH 4.19 033/110] bfs: add sanity check at bfs_fill_super() To: gregkh@linuxfoundation.org Cc: LKML , stable@vger.kernel.org, Tetsuo Handa , syzbot , Andrew Morton , willy@infradead.org, torvalds@linux-foundation.org Content-Type: multipart/mixed; boundary="000000000000c49aba057bcf42b3" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000c49aba057bcf42b3 Content-Type: text/plain; charset="UTF-8" Hello, Yes, of course I object to it. I ignored this version of the patch being applied to the older Linux versions, but for the latest versions surely the version that I have authored should be applied instead. I have sent to Andrew Morton both the 4.20-rc1 and 4.19.2 versions of the patch. The 4.20 was applied (as "linux-next", I don't know why it is not in 4.20-rc4 yet), but 4.19.2 version was not applied yet, so here it is attached again (with the proper changelog etc). It applies to 4.19.5 cleanly as well, so please use this version (attached). Kind regards, Tigran On Thu, 29 Nov 2018 at 14:29, Greg Kroah-Hartman wrote: > > 4.19-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Tetsuo Handa > > commit 9f2df09a33aa2c76ce6385d382693f98d7f2f07e upstream. > > syzbot is reporting too large memory allocation at bfs_fill_super() [1]. > Since file system image is corrupted such that bfs_sb->s_start == 0, > bfs_fill_super() is trying to allocate 8MB of continuous memory. Fix > this by adding a sanity check on bfs_sb->s_start, __GFP_NOWARN and > printf(). > > [1] https://syzkaller.appspot.com/bug?id=16a87c236b951351374a84c8a32f40edbc034e96 > > Link: http://lkml.kernel.org/r/1525862104-3407-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp > Signed-off-by: Tetsuo Handa > Reported-by: syzbot > Reviewed-by: Andrew Morton > Cc: Tigran Aivazian > Cc: Matthew Wilcox > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > Signed-off-by: Greg Kroah-Hartman > > --- > fs/bfs/inode.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > --- a/fs/bfs/inode.c > +++ b/fs/bfs/inode.c > @@ -350,7 +350,8 @@ static int bfs_fill_super(struct super_b > > s->s_magic = BFS_MAGIC; > > - if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) { > + if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) || > + le32_to_cpu(bfs_sb->s_start) < BFS_BSIZE) { > printf("Superblock is corrupted\n"); > goto out1; > } > @@ -359,9 +360,11 @@ static int bfs_fill_super(struct super_b > sizeof(struct bfs_inode) > + BFS_ROOT_INO - 1; > imap_len = (info->si_lasti / 8) + 1; > - info->si_imap = kzalloc(imap_len, GFP_KERNEL); > - if (!info->si_imap) > + info->si_imap = kzalloc(imap_len, GFP_KERNEL | __GFP_NOWARN); > + if (!info->si_imap) { > + printf("Cannot allocate %u bytes\n", imap_len); > goto out1; > + } > for (i = 0; i < BFS_ROOT_INO; i++) > set_bit(i, info->si_imap); > > > --000000000000c49aba057bcf42b3 Content-Type: text/x-patch; charset="US-ASCII"; name="bfs-4.19.2.patch" Content-Disposition: attachment; filename="bfs-4.19.2.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jp2qu79t0 RnJvbTogVGlncmFuIEFpdmF6aWFuIDxhaXZhemlhbi50aWdyYW5AZ21haWwuY29tPgpTdWJqZWN0 OiBiZnM6IGV4dHJhIHNhbml0eSBjaGVja2luZyBhbmQgc3RhdGljIGlub2RlIGJpdG1hcAoKU3Ry ZW5ndGhlbiB2YWxpZGF0aW9uIG9mIEJGUyBzdXBlcmJsb2NrIGFnYWluc3QgY29ycnVwdGlvbi4K TWFrZSBpbi1jb3JlIGlub2RlIGJpdG1hcCBzdGF0aWMgcGFydCBvZiBzdXBlcmJsb2NrIGluZm8g c3RydWN0dXJlLgpQcmludCBhIHdhcm5pbmcgd2hlbiBtb3VudGluZyBhIEJGUyBmaWxlc3lzdGVt IGNyZWF0ZWQg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