From patchwork Mon Jul 9 12:55:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 10514543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 451216032C for ; Mon, 9 Jul 2018 12:56:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C1228A14 for ; Mon, 9 Jul 2018 12:56:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2505328B6D; Mon, 9 Jul 2018 12:56:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C13AD28A14 for ; Mon, 9 Jul 2018 12:56:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C32BE6B02CC; Mon, 9 Jul 2018 08:56:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BE3B96B02CE; Mon, 9 Jul 2018 08:56:10 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD37D6B02CF; Mon, 9 Jul 2018 08:56:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 6EB0D6B02CC for ; Mon, 9 Jul 2018 08:56:10 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id w11-v6so5641377pfk.14 for ; Mon, 09 Jul 2018 05:56:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to :references:cc:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=mbFqF9QV/Kiom8rqkuECZsTXqpIeigGuOGJEJ74dDBQ=; b=VyDpVpT0RCJeXLdvJpYfhP3vcM/fckPi7+GC8QQKialyvQoMFZ0OSPZp+8Pt6Odxro eWc6nemc2Nbcyrh/lG2tSyHj3mHwTIzYg3oe3uJHCrMIXNT3JS/Fyg1oAh/ofi5FVEry 53oD/C1wU9lNQaFnVJ94ovEHybGu1DuXZVIKb6TiNUFwyIaYZPUdqUwyTSXBCtDr5Uhx cIycang8kFYHAt7TkZ7bCocBvKvFO95E2tveQUC5VD4Nj7N2HNfks9VPZ5Y5BdlKNLYK bZhcz2hxwK30bQUVAvUV8dH0E2u+TnMjr75O8oK/znU1RJmhUbLvh8MSONhnMXK6jHSW /9fQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp X-Gm-Message-State: APt69E1bT4qNsI/HsP+r1xruZiJ8h8Ts1dTxusmFMURwkk6aByKUZ2tv 4R5aFD79tzatO3VVrk7MErjyU4mF0m/rKIfk932BX7KaW7c/JugWjJnwUndjtPSB0CilU7TPnVI G2fCpr0GG8bMq36DO6x0X6QrRdcZkh1AfVf8RGFqWudX+zMwhZFw2sO4AaCALXcGDiQ== X-Received: by 2002:a63:c44a:: with SMTP id m10-v6mr18890885pgg.416.1531140970117; Mon, 09 Jul 2018 05:56:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcM94BbDN3qBI5U4xhtQNta9Trt+RZGd1DQfuRjZSPIJtEGH7YT+uoJR1TOXMSVrE+jF8Wx X-Received: by 2002:a63:c44a:: with SMTP id m10-v6mr18890855pgg.416.1531140969327; Mon, 09 Jul 2018 05:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531140969; cv=none; d=google.com; s=arc-20160816; b=Ulzwm3gJRdUsgsh5gl3bMHizWXLLdCai1/KQp/4oK/J1fjIXJVeWTBL8b3erLkZqi7 Nj0E6bACHzJ7WvQ9M+Gh14yp5rWIrVHTKbuhjCFRENuwYOWycYhzUhaXHH7HCH1LK2wX JYbG/7Z468GksVmSnlUvK1MHDebeQSLNmr27fphRxHXv1+q60rz0bHfhxIPN0sR0xPfJ xb3e1m4OXYLcAHXdq8I37cNoZMEGgLA9n1JWOsQd65Oj24OhDH0H0P17a2I9SPB+ai/l EmkGjLBWueAnGJu+5/8sZKERu7ouF3sMRx4jjbs2KMdAaiuwK5bR5oCNP2VzYaqMHY/k ji+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:references:to:subject :arc-authentication-results; bh=mbFqF9QV/Kiom8rqkuECZsTXqpIeigGuOGJEJ74dDBQ=; b=THENQJdn66i4wvUCxQJgoyz5CTp3x0AB6EfJDuQ+o4PHO0jEO0hF7AHssPnFBkg8rG eusRIwHQ/eeDw2QLAhVIJJO0wD9JYdGCcnOtLxM/XO6Ll3N/WK3Acdsrqq9aXuwYBGo7 g0cL4G8FFX/DfJBzZ/BHsdSRTNU74V75x6CNmMUi5mslC2juLIYOSInNLAmYxrwnnxwd ihBDz9XYpwMpBjDx2J1miO7Bdc+w39BCdHsVAtIcIdvk93GN3wlsjWV+y2BR6/v7Ar5I KYEbSJULjivAdE6F6KLP+YZTZ7T/wQpDh0uGxwFuB9VhEL4sZizhrYDm5igDOuGR2jXl R2cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from www262.sakura.ne.jp (www262.sakura.ne.jp. [202.181.97.72]) by mx.google.com with ESMTPS id r11-v6si13631107pgs.274.2018.07.09.05.56.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 05:56:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) client-ip=202.181.97.72; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from fsav402.sakura.ne.jp (fsav402.sakura.ne.jp [133.242.250.101]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w69CtI3M053863; Mon, 9 Jul 2018 21:55:18 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav402.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav402.sakura.ne.jp); Mon, 09 Jul 2018 21:55:18 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav402.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w69CtE6r053843 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Jul 2018 21:55:17 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Subject: Re: BUG: corrupted list in cpu_stop_queue_work To: Matthew Wilcox References: <00000000000032412205706753b5@google.com> <000000000000693c7d057087caf3@google.com> Cc: syzbot , bigeasy@linutronix.de, linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk, mingo@kernel.org, peterz@infradead.org, syzkaller-bugs@googlegroups.com, tglx@linutronix.de, linux-mm From: Tetsuo Handa Message-ID: <1271c58e-876b-0df3-3224-319d82634663@I-love.SAKURA.ne.jp> Date: Mon, 9 Jul 2018 21:55:17 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <000000000000693c7d057087caf3@google.com> Content-Language: en-US X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Hello Matthew, It seems to me that there are other locations which do not check xas_store() failure. Is that really OK? If they are OK, I think we want a comment like /* This never fails. */ or /* Failure is OK because ... */ for each call without failure check. From d6f24d6eecd79836502527624f8086f4e3e4c331 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Mon, 9 Jul 2018 15:58:44 +0900 Subject: [PATCH] shmem: Fix crash upon xas_store() failure. syzbot is reporting list corruption [1]. This is because xas_store() from shmem_add_to_page_cache() is not handling memory allocation failure. Fix this by checking xas_error() after xas_store(). [1] https://syzkaller.appspot.com/bug?id=ccf34b892706ff6f3321da526329476eab23d5a0 Signed-off-by: Tetsuo Handa Reported-by: syzbot+d8a8e42dfba0454286ff@syzkaller.appspotmail.com Fixes: "shmem: Convert shmem_add_to_page_cache to XArray" --- mm/shmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 0f151c8..382aeb3 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -606,6 +606,8 @@ static int shmem_add_to_page_cache(struct page *page, } next: xas_store(&xas, page + i); + if (xas_error(&xas)) + goto unlock; if (++i < nr) { xas_next(&xas); goto next;