From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16536C2BBE2 for ; Fri, 6 Dec 2019 16:24:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CCA222464E for ; Fri, 6 Dec 2019 16:24:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCA222464E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B280A6B16C3; Fri, 6 Dec 2019 11:24:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B00956B16C4; Fri, 6 Dec 2019 11:24:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A170C6B16C5; Fri, 6 Dec 2019 11:24:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 88E576B16C3 for ; Fri, 6 Dec 2019 11:24:56 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 45E5A181AEF00 for ; Fri, 6 Dec 2019 16:24:56 +0000 (UTC) X-FDA: 76235240592.29.copy89_482634bc2382a X-HE-Tag: copy89_482634bc2382a X-Filterd-Recvd-Size: 2337 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Dec 2019 16:24:55 +0000 (UTC) Received: from dhcp-172-16-25-5.sw.ru ([172.16.25.5]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1idGPO-00009Z-Ih; Fri, 06 Dec 2019 19:24:46 +0300 Subject: Re: [PATCH 3/3] kasan: don't assume percpu shadow allocations will succeed To: Daniel Axtens , kasan-dev@googlegroups.com, linux-mm@kvack.org, glider@google.com, linux-kernel@vger.kernel.org, dvyukov@google.com Cc: daniel@iogearbox.net, cai@lca.pw, syzbot+82e323920b78d54aaed5@syzkaller.appspotmail.com, syzbot+59b7daa4315e07a994f1@syzkaller.appspotmail.com, Andrew Morton References: <20191205140407.1874-1-dja@axtens.net> <20191205140407.1874-3-dja@axtens.net> From: Andrey Ryabinin Message-ID: <87172e8f-9698-0805-252f-55f68ee07862@virtuozzo.com> Date: Fri, 6 Dec 2019 19:24:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20191205140407.1874-3-dja@axtens.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/5/19 5:04 PM, Daniel Axtens wrote: > syzkaller and the fault injector showed that I was wrong to assume > that we could ignore percpu shadow allocation failures. > > Handle failures properly. Merge all the allocated areas back into the free > list and release the shadow, then clean up and return NULL. The shadow > is released unconditionally, which relies upon the fact that the release > function is able to tolerate pages not being present. > > Also clean up shadows in the recovery path - currently they are not > released, which leaks a bit of memory. > > Fixes: 3c5c3cfb9ef4 ("kasan: support backing vmalloc space with real shadow memory") > Reported-by: syzbot+82e323920b78d54aaed5@syzkaller.appspotmail.com > Reported-by: syzbot+59b7daa4315e07a994f1@syzkaller.appspotmail.com > Cc: Dmitry Vyukov > Cc: Andrey Ryabinin > Signed-off-by: Daniel Axtens > --- Reviewed-by: Andrey Ryabinin