From patchwork Thu Nov 5 00:02:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11883123 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 B9D17C00A89 for ; Thu, 5 Nov 2020 04:24:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FEA420825 for ; Thu, 5 Nov 2020 04:24:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xGYEzAwI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FdrQhzry"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="TtFB7Uef" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FEA420825 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e9odu6nAYelfxHH0aMsDQxVWFm0/4FJrUjyjwWos5Oc=; b=xGYEzAwIx4+PdlPjaaUZmSryR /FoqgHDtUY2NIdMQzwmaWxI+QHW7oA2y39FMtmo0ISVFFpxAYSYM/FSF0fNpL5wwvlrxZYUy+iHwJ nf+bfdPanlniL8pLZye698IOKyIYrzqPFqh51upv0pPc7XQeOfIx2ugGQDaEvleajVKFC7edgnq7X 0yzZ1tjQAJj7XIiM8xqKYFckAR1mK7/EhDKLhU2IT/YK9K8NNz9NYjdeuJ69uXSePT90JF6E8Etso qCiQ4QftKwXNDAggzdVop2ZPNGKq+Mb2k5Nz6ykA9zQh8qW11qELqZjot9hYYM0LZl1NSSvUGiVjG q+toeNXXw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaWnQ-0006J5-3h; Thu, 05 Nov 2020 04:22:48 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaW3v-000145-NR for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:35:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ocomz11lJ9KE0anC5CzM99SKlSLQ0mxGbD3mCLha9hU=; b=FdrQhzryDZdfdg1Xn4HYTqt2GF sIUqgTDEq16cGwGJTFXba5TQb3M87p52K80v3Rn12WcM8wi+dfP8N/XXxc9Gr8/hVZswEZpejAgqc 6pBgWu3OulHa6BEddJTnYq0AFy10OGXff0XRWZIMR0DHTRxeMi56QrewxA03HacQ1gQvN5+Goq6oa MzLam6fZbXYZ78Qe0fskUQv9z6YbMAaMxdt6DVb6STy+Y5aLDbhPSdMHDd9iHX0cr0rToEg+PZ0Ux h7DpBdud/5XCDTrcc+sUVR2By7z7sNxzuXYsF3y283RnH97AFi1PR23T3FpTnDeolBvPCir8LnbSA 2B4pEQ1Q==; Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaSkd-0000mO-N8 for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 00:03:43 +0000 Received: by mail-wr1-x449.google.com with SMTP id m20so84785wrb.21 for ; Wed, 04 Nov 2020 16:03:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=Ocomz11lJ9KE0anC5CzM99SKlSLQ0mxGbD3mCLha9hU=; b=TtFB7UefTiyPVVP+/kDhkkT/QxrHuTo+WYQ5Nvww663l3VqibyXgl53WW2WtoolN3r wYf3SBvI/y4/ED+RCCuwa5/pUZX+bY9wrT2Bkruuc8LKJG6Bx3xM1sQnPbF8GcOx8QmF mz7OfwCckO0gu8SIJZZwnULGnyIrzmYFoX7VIZiDvB2t8IjiO5TJICScNGjWfBA3MowY ev/8Po/TamKjG9Q11/jRnwJFgLkXoxfftwqGS4W/r0zgAIkuTcAbu3CICmE1xGNfhTHR o/P2LK0i0XtpoXyE+a1Wqq6TJ8dXDS83gGcR1mvWnopVytCSBBuVDZGQMksX5hYTNfHR TmAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Ocomz11lJ9KE0anC5CzM99SKlSLQ0mxGbD3mCLha9hU=; b=XRB7T/i666LNg1PFH7OI71wkGvZQUEOncYK/j7Ommz2yN3g2JnEWl8462gmgwqRV5I +IFK3wiFN/5Co8gZU9vpl1UV9kNl3mQuQVH5Gjk7X3Py5/FMHRrG5tvzimdJicwQGtgw XrQusrYFjrL4N7wykF2qVE2AQnD0gu7p2mIdub8PO7R55SfTYq4Z83DCzLRWmk12g9dE a+hFJfhxffoFkHTWqb8CIIECgyxgtn35OJdsKC4+GaQOAWWvl6UHG73slvMgBi8104kJ 4c4FJp49gCKKVZ3mwsbRgzzWnIpKnOZ1hFXCdufCa8V483kIoPBbzBryYOW9T5DY22Ve kONQ== X-Gm-Message-State: AOAM5327q2ZYOAC+anjEB/h1MsMjtlFCb7JzRYmIwTAQvmc4tVka4ZN+ oYqh0rpxhhlsujawG/d3oJyMcF1yqSJx4i0K X-Google-Smtp-Source: ABdhPJxLptJ2NppRam2U5gruDbgx9bSTsC/cH6+ET8/IVRhCo/jAA8pQOAD70gM5B+ZoIP4EkLlv3XYmcaaXloEn X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:600c:22d3:: with SMTP id 19mr178957wmg.161.1604534557830; Wed, 04 Nov 2020 16:02:37 -0800 (PST) Date: Thu, 5 Nov 2020 01:02:11 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH 01/20] kasan: simplify quarantine_put call site From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_000339_996444_901E3214 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Branislav Rankov , Andrey Konovalov , Kevin Brodsky , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Andrew Morton , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move get_free_info() call into quarantine_put() to simplify the call site. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f --- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 5 ++--- mm/kasan/quarantine.c | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 2bb0ef6da6bd..5712c66c11c1 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -308,7 +308,7 @@ static bool __kasan_slab_free(struct kmem_cache *cache, void *object, kasan_set_free_info(cache, object, tag); - quarantine_put(get_free_info(cache, object), cache); + quarantine_put(cache, object); return IS_ENABLED(CONFIG_KASAN_GENERIC); } diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index b0a57d8f9803..994be9979ffd 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -214,12 +214,11 @@ struct kasan_track *kasan_get_free_track(struct kmem_cache *cache, #if defined(CONFIG_KASAN_GENERIC) && \ (defined(CONFIG_SLAB) || defined(CONFIG_SLUB)) -void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache); +void quarantine_put(struct kmem_cache *cache, void *object); void quarantine_reduce(void); void quarantine_remove_cache(struct kmem_cache *cache); #else -static inline void quarantine_put(struct kasan_free_meta *info, - struct kmem_cache *cache) { } +static inline void quarantine_put(struct kmem_cache *cache, void *object) { } static inline void quarantine_reduce(void) { } static inline void quarantine_remove_cache(struct kmem_cache *cache) { } #endif diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index 580ff5610fc1..a0792f0d6d0f 100644 --- a/mm/kasan/quarantine.c +++ b/mm/kasan/quarantine.c @@ -161,11 +161,12 @@ static void qlist_free_all(struct qlist_head *q, struct kmem_cache *cache) qlist_init(q); } -void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) +void quarantine_put(struct kmem_cache *cache, void *object) { unsigned long flags; struct qlist_head *q; struct qlist_head temp = QLIST_INIT; + struct kasan_free_meta *info = get_free_info(cache, object); /* * Note: irq must be disabled until after we move the batch to the