Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1028499pxb; Fri, 15 Apr 2022 18:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWl+Hwr5qPFi3A6R2sC6GHwUx+b4nHPxlKG0/XP9cX0/HK/yPz6LCKCKtFqa32P9OehBhZ X-Received: by 2002:a17:90a:c3:b0:1ca:54c1:a684 with SMTP id v3-20020a17090a00c300b001ca54c1a684mr1717216pjd.148.1650073957777; Fri, 15 Apr 2022 18:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650073957; cv=none; d=google.com; s=arc-20160816; b=pIbmptLgeoIrnHmJTXQmcIRNSABJcd6FyfyzbW8Gy2NXRpQolpmSp+Bet7WG+AWjkp DlcXkeobzdaKfFytT2P7Mn11XLOqKM7NqUbe/h2mOOshFNcJ6R3XLca7Zn+BYhelSnbQ VZ1/iYWJsCzl+OQK+t7JtoLDh6/SrtnQyW19C99LewwOfICfGBVnQD3uelyaLijXqBGn E7akRG6nrY6RsStcbqAUJMCQsRLf2JSx7d4m3WmsHy37Ic370VBI62C8Z6X0XvhRQy3p I1cdctrK6Z1uwvq44Oxr7xWCmJDhPYK61ID3Fbgn5DcUalhmaVEROYkgISXXR1acoegU +JHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:in-reply-to:date :mime-version; bh=63dgzYb/YD/fHyGcMt+vSjeSoQXMPp9ik+UDymjhyew=; b=qdiU1dBVSR7Pz9MnL+FCeRnrn0YyPneCD2ZJqLw1HyAactXJkVVjMbd56wTxwv99Y6 B/Wa3YnpH3MPxxB7Us7uQTtzppRq+Sv+vPMLhpJKl77H7KS94JxsbAV78GmtOR/Mi52/ qvyAWo5AtFeMMng1kDSq3bfDPpucDZBAC5FBm0QDiTFDESLWpWF6NuZ7Iw6YnGvGS4eG 1HaaGBWH1T92JNTz+96yosj20bAimQW7auZ0GqEMs7FRx9EuDESLf4i31o5o8WGIiik6 mTaacuqT62j9OHce1w+mxMyaUbvsJkHhJz7DNp7spdxEqXl1v9fUJoscXLjuCr1fm4MN D4Ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l64-20020a638843000000b003816043efecsi2912925pgd.481.2022.04.15.18.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B6590A76F3; Fri, 15 Apr 2022 18:14:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237659AbiDNNrq (ORCPT + 99 others); Thu, 14 Apr 2022 09:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343864AbiDNNaC (ORCPT ); Thu, 14 Apr 2022 09:30:02 -0400 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB81EB0D1A for ; Thu, 14 Apr 2022 06:25:31 -0700 (PDT) Received: by mail-il1-f198.google.com with SMTP id o17-20020a92c691000000b002c2c04aebe7so3001499ilg.8 for ; Thu, 14 Apr 2022 06:25:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:date:in-reply-to:message-id:subject :from:to:cc; bh=63dgzYb/YD/fHyGcMt+vSjeSoQXMPp9ik+UDymjhyew=; b=T4HXgTSTX+JHmV1b/q7Bim4nmMgKQPubwHUboFgCNVJ7ssbi2Iqk1HV3U9zoNFAQN3 LZ5hd/DbrHPyVJBj2lqXm2VcgF0VDiq2fAsXw84KxR1fHy7mphqn6+YkcC6Fpohh9CFp 56fCgR67cql8mJzRRVshlVMbpWVmdfYXl25KejAfKKYwC/rhhLAKMbguSf9hMi8sxRjp zPtAT5wghcItSASCYs2h3hTkqcdvSgXeGQGQef3O34/a5e5WT4FPYR02aJZ6U7DN5b31 RwexttNVj3GquenyU6GDFydMp6zKKuMOdLolkqpwlWxKanr13A/pB0P+EPNYqejZB/C3 wJew== X-Gm-Message-State: AOAM532Z5N+lzw9p3rnTAMV/gd25u9jOuSk8YmJ2LmYtir/JUBscCjlX umgiV8dRn3snybe+1L+++qZiKZq255jsl5hik8FSBCySZHHt MIME-Version: 1.0 X-Received: by 2002:a05:6638:13d5:b0:323:a795:ccf0 with SMTP id i21-20020a05663813d500b00323a795ccf0mr1124962jaj.265.1649942730964; Thu, 14 Apr 2022 06:25:30 -0700 (PDT) Date: Thu, 14 Apr 2022 06:25:30 -0700 In-Reply-To: <20220414110844.587766421@linuxfoundation.org> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <0000000000006103b605dc9d3a02@google.com> Subject: Re: [PATCH 4.19 200/338] ext4: dont BUG if someone dirty pages without asking ext4 first From: syzbot To: Greg Kroah-Hartman Cc: gregkh@linuxfoundation.org, lee.jones@linaro.org, linux-kernel@vger.kernel.org, sashal@kernel.org, stable@vger.kernel.org, tytso@mit.edu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Theodore Ts'o > > [ Upstream commit cc5095747edfb054ca2068d01af20be3fcc3634f ] > > [un]pin_user_pages_remote is dirtying pages without properly warning > the file system in advance. A related race was noted by Jan Kara in > 2018[1]; however, more recently instead of it being a very hard-to-hit > race, it could be reliably triggered by process_vm_writev(2) which was > discovered by Syzbot[2]. > > This is technically a bug in mm/gup.c, but arguably ext4 is fragile in > that if some other kernel subsystem dirty pages without properly > notifying the file system using page_mkwrite(), ext4 will BUG, while > other file systems will not BUG (although data will still be lost). > > So instead of crashing with a BUG, issue a warning (since there may be > potential data loss) and just mark the page as clean to avoid > unprivileged denial of service attacks until the problem can be > properly fixed. More discussion and background can be found in the > thread starting at [2]. > > [1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@quack2.suse.cz > [2] https://lore.kernel.org/r/Yg0m6IjcNmfaSokM@google.com > > Reported-by: syzbot+d59332e2db681cf18f0318a06e994ebbb529a8db@syzkaller.appspotmail.com > Reported-by: Lee Jones > Signed-off-by: Theodore Ts'o > Link: https://lore.kernel.org/r/YiDS9wVfq4mM2jGK@mit.edu > Signed-off-by: Sasha Levin > --- > fs/ext4/inode.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 7959aae4857e..96cf0f57ca95 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -2148,6 +2148,15 @@ static int ext4_writepage(struct page *page, > else > len = PAGE_SIZE; > > + /* Should never happen but for bugs in other kernel subsystems */ > + if (!page_has_buffers(page)) { > + ext4_warning_inode(inode, > + "page %lu does not have buffers attached", page->index); > + ClearPageDirty(page); > + unlock_page(page); > + return 0; > + } > + > page_bufs = page_buffers(page); > /* > * We cannot do block allocation or other extent handling in this > @@ -2697,6 +2706,22 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) > wait_on_page_writeback(page); > BUG_ON(PageWriteback(page)); > > + /* > + * Should never happen but for buggy code in > + * other subsystems that call > + * set_page_dirty() without properly warning > + * the file system first. See [1] for more > + * information. > + * > + * [1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@quack2.suse.cz > + */ > + if (!page_has_buffers(page)) { > + ext4_warning_inode(mpd->inode, "page %lu does not have buffers attached", page->index); > + ClearPageDirty(page); > + unlock_page(page); > + continue; > + } > + > if (mpd->map.m_len == 0) > mpd->first_page = page->index; > mpd->next_page = page->index + 1; > -- > 2.34.1 > > > I see the command but can't find the corresponding bug. The email is sent to syzbot+HASH@syzkaller.appspotmail.com address but the HASH does not correspond to any known bug. Please double check the address.