Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3877098pxb; Tue, 17 Nov 2020 06:02:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlBSap7pTjFrzefla8EXJ3kcJATrgvOYvG3t4ysbM1zRvsWLNsTPcUaZwxP4UrcAwYcsu/ X-Received: by 2002:a1c:3c84:: with SMTP id j126mr4684109wma.151.1605621733689; Tue, 17 Nov 2020 06:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621733; cv=none; d=google.com; s=arc-20160816; b=Nnmt0XMIW/FbbrZ+NG5FtmlvoWdTyfSLl6UMUbVnKpdaobtLxQ3z16a0lW+5NsvbA/ 2rKtWrTASxi4qtZLj46TxBG7xQFqkFeTVDH8yDnBcuHtJ8Vx0jATzXS7aI9MM84y8bai 7dw/2HjwvF9KzELJkqGPJcDmfLPj5fLu23n/kups8KkjnkT7zIw5XURklASbLBF4bdFg deSY26+9M/SE0v71xskIzFQpw1l6TJbBwUjjt/1sBSDjh5m3C3XHQ2hMyvbL+pAKVbWC QbbylD6tws01ze7fHhPbD6edxUjE1LQT/rR0s2aMwjXDULLsitpM8aYXxc3/sKZ9wWTC unzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Pa0dw+2YDpQA3Ip7yWMCpwDF+q2V8p/vPHE4K5vOsWU=; b=BMbMlDVp4Am6Z5nQC+2sqTEAnaZUcwiks4/32ouwfz4D+vCR5bnat+zhqFhuc84//A beQWFI8XSVI2a7DtPj2WMOIwWe9bx6gPdHq38cbmjgLsmVetEMT9/Yx8ytHL2Q9KNg2y 3mao4ZRTUWPVnymgb5QdR2QMRoPOBbGm3DlyZhf8gIXuwrJfFFBAR03nFPqn0IKbHy3H 6Gxkkr3cGOEayDHv5YvcoFCfozNy4xhIUnU/HEUHzNTImLjOOqOrJWdefmeFvPZz77Ev 8jd0yiLKELAdc9kS/pkK4A+vmbSrGRY/4UnGylm4t/3dee2Xc9AIIU2EVoqplfgmg3mq g44w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kHpe6Zac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si8127341ejj.742.2020.11.17.06.01.47; Tue, 17 Nov 2020 06:02:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kHpe6Zac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731375AbgKQN6v (ORCPT + 99 others); Tue, 17 Nov 2020 08:58:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730714AbgKQNSp (ORCPT ); Tue, 17 Nov 2020 08:18:45 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 353F9C0613CF for ; Tue, 17 Nov 2020 05:18:45 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id 79so19295598otc.7 for ; Tue, 17 Nov 2020 05:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pa0dw+2YDpQA3Ip7yWMCpwDF+q2V8p/vPHE4K5vOsWU=; b=kHpe6ZacvQalxImqYZ7Y/Tk8Xjw4k5FGX1UY3t/LRIwWRZmd9vBOLAnRtGqkYTNV/8 N1tM1Z4t15cJ3hI03/Fqy/u766FH2Q7C8ibXnQH7ygnlt6SoY516fehJgltRw4Tdf5ou /MIP8VoxRk3+7pMZiBxotFbBZH69xaXFxn/P770IbhdeB8US1QVd5wwWZSv2TGMJMdDq q1vj0z/gj/AVe8F1on0J3RXV2WEidKxliEvz9jYscGMLWveMr31Z1FwxwYoWb4MwZ8K7 RXBTdRlJRkRk6umlo+RJd4UAY9lxe5infHlR0AznIXeW8P+2ovCZb7vlhoqecEma65s+ 4xJQ== 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=Pa0dw+2YDpQA3Ip7yWMCpwDF+q2V8p/vPHE4K5vOsWU=; b=iqvinht+A6PFyOzxQeBXemCalYC1SdWqFMok2D6pz0s3Bix3hUCdJBT1e2r8/pDlnt 2B+7X8i+4vByMMYlvpPQUSHlNR7EuAuEN9tTcJ/LNQ/FqxQ+mt5JN+GvrkMhwDXgOj3X YXC2V7bS8tUIBNoD7c8zl8VN6hJDYXjLXYFw1t/i8XhCltDgP0SKVJLLeDKKz0HNubWh FCp49Y3SKKlUByllckIROfD8VkC3NScbtDwu1RaH1d6lAG6+46ilsdWflPQ+J1+0286o xnyiThGuJFq/RXSI/mYRs6Y/kUzV5Bixw05v+nbV9Z11Rojgm887B08bk7nSqRGB4/2j LBlA== X-Gm-Message-State: AOAM532Jzeied+6LoP/P43tJo4ih7Ui4HrtxUXIf+sE87XD/hO8D22BS M1LiWLWMVkpZ3MD7zWMQgpJsRaR2OwDhqtyEkb3YKA== X-Received: by 2002:a9d:f44:: with SMTP id 62mr3111227ott.17.1605619124327; Tue, 17 Nov 2020 05:18:44 -0800 (PST) MIME-Version: 1.0 References: <52518837b34d607abbf30855b3ac4cb1a9486946.1605305978.git.andreyknvl@google.com> In-Reply-To: From: Marco Elver Date: Tue, 17 Nov 2020 14:18:32 +0100 Message-ID: Subject: Re: [PATCH mm v3 17/19] kasan: clean up metadata allocation and usage To: Dmitry Vyukov Cc: Andrey Konovalov , Andrew Morton , Catalin Marinas , Will Deacon , Vincenzo Frascino , Andrey Ryabinin , Alexander Potapenko , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev , Linux ARM , Linux-MM , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Nov 2020 at 14:12, Dmitry Vyukov wrote: > > + */ > > *(u8 *)kasan_mem_to_shadow(object) = KASAN_KMALLOC_FREE; > > + > > ___cache_free(cache, object, _THIS_IP_); > > > > if (IS_ENABLED(CONFIG_SLAB)) > > @@ -168,6 +173,9 @@ void quarantine_put(struct kmem_cache *cache, void *object) > > struct qlist_head temp = QLIST_INIT; > > struct kasan_free_meta *meta = kasan_get_free_meta(cache, object); > > > > + if (!meta) > > + return; > > Humm... is this possible? If yes, we would be leaking the object here... > Perhaps BUG_ON with a comment instead. If this is possible in prod-mode KASAN, a WARN_ON() that returns would be safer.