Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp59928imu; Tue, 27 Nov 2018 09:01:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UFZjWEiuWqVROsEM3TTPhPh3T6BQ2Pji59+LRqOyhSU/TX32m2ePif/45XrE6+c3rjN0/d X-Received: by 2002:a63:8ac4:: with SMTP id y187mr30065505pgd.446.1543338116560; Tue, 27 Nov 2018 09:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543338116; cv=none; d=google.com; s=arc-20160816; b=ynRpTOzSg3RmP7Rbcegg7kvSx/enVEeA3edZl3k8qkNDh6O55bTQVo/Gq1pqKpdHYj vxIhQezl+qJheShP5vVbXJNzselLvPVBbePjLqCYG/coz1HHbdUCnLhJExMMWzO4kZVS O7iZXLwrpIp2RnRR41D6rzDkZ8JfssrnOgKUDDplnA3xO8HGEtjmKXT3JBe4qCZkZXAo ubjKrxSLx7Jiup/fh8xr8Ga47VlYMWKZfdY8tjjzq/YoVVhVx6g4GVCMLZ3mxu/sHICc Q6ziQLCcVlZFXTa3lStygkz9Hda0zh11rXvG+kgdrGUznT+xDKfveug5MGhwyoeKjkEs xOJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6oli7mrp3g3rho/Q8+rQCYCaCVtzysg9eZI+aaASr7k=; b=qO4qQJs9rxvffOo9TrzCYVdcwQORcMEw5EPYYFSgXmtKvp+b/xU7wvM54Y5B1COdv9 D/M+Ed9lYKCWjSSgqf6Vpi4t1EF8VwMVfwckJVBYBB3O85TeJboQ4PT18gn7DkcsBa2m giFFMJmqVkdwO3Z+cacA5aDjws/vp/Ecsn2BLTiaWSlFaFlQ6W5r/97rLU2s/KssF9KI acdW2zKNJYfm4o0DHSgL9P+kqCS5yriUZHJ7saZkkxoWhVQqn1VhYYTQJXQm4vIdQ2jc ivorW/K88Sync93WwRKAk7wDEl1etJrkdfOefhlbiyOhfu879tR8WQS2gLbWHm92KvPl lwNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aKhKOY0O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id y6si3970665plr.186.2018.11.27.09.01.33; Tue, 27 Nov 2018 09:01:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aKhKOY0O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731479AbeK1DyZ (ORCPT + 99 others); Tue, 27 Nov 2018 22:54:25 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51748 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeK1DyY (ORCPT ); Tue, 27 Nov 2018 22:54:24 -0500 Received: by mail-wm1-f66.google.com with SMTP id j207so15503770wmj.1 for ; Tue, 27 Nov 2018 08:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6oli7mrp3g3rho/Q8+rQCYCaCVtzysg9eZI+aaASr7k=; b=aKhKOY0OenSL2Quk581daGUh2I4SrPb/lcGdloHjtGv3j0n+5niFdy9ol4BcCBQ7ks 62cBb14ijs9os54D4xWD8JNgz79PmXwjxifzFhWrEpNSlggyZ5NU2DESqPbG4cUfrzZK +7Wp5K21Hs+NeLhTYqsmNPpDvO2OCfjxPuncqcytdoDMYnVJn5y5jI8t2/rZUVjVp9ls LbG/My2qhXCzylS+TNZHQ5emt4LmdEcjeI1SmnN3HnBF6cHDho2vC4Tnn4KpNxa+PKT8 9UfKSfQcm+YNGouv2+PZMimvKBXCp9DADxnrFIFJy7bVnUX4aWQFUZfh9p133A9kQ4MT c0Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6oli7mrp3g3rho/Q8+rQCYCaCVtzysg9eZI+aaASr7k=; b=klNX4WQ43qJ4mZeCzrMkG1YYNslaxAFV2aLjrMSz97L2A/k/oNj6pAT1c+/S4W1p7t wMcY9ZWohGcicbnYZhOgT1qsnp4D3bpnUOhmcY0NjrBu7OF83humVKbF7KbYh+ieRL5+ DQLQmmckhJHuh5eR2pRTV975roYGppruBQk3tuunH7qUgehJgyV4ttdKDRqiGGiTC4ox GR1KR64XqFxHJ+LsPZps4ye3SW7XDHbi9k+wROfmL1BU/XSwwX+ZQwr3Q5PxZqCqXkWm pUh2P1a8fsFrSiqr+03OhZb+dV8SckIFXEcc61BVGaiHZf9M8998r775V4KlO+IKMIxp R6FA== X-Gm-Message-State: AGRZ1gI2sIV2EOpk8+/SCl9idVCNYatOUkvQQ1rniEnJ7MnHZ2X4oGzN O93MXAVlVdlY1xNoXfuXKjBVGg== X-Received: by 2002:a7b:c1d6:: with SMTP id a22mr27114136wmj.48.1543337751557; Tue, 27 Nov 2018 08:55:51 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id k73sm6383099wmd.36.2018.11.27.08.55.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 08:55:50 -0800 (PST) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan , Andrey Konovalov Subject: [PATCH v12 02/25] kasan, slub: handle pointer tags in early_kmem_cache_node_alloc Date: Tue, 27 Nov 2018 17:55:20 +0100 Message-Id: <3459b9f5d4daf96668d9579da2cf15eb5523284b.1543337629.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous patch updated KASAN hooks signatures and their usage in SLAB and SLUB code, except for the early_kmem_cache_node_alloc function. This patch handles that function separately, as it requires to reorder some of the initialization code to correctly propagate a tagged pointer in case a tag is assigned by kasan_kmalloc. Signed-off-by: Andrey Konovalov --- mm/slub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index fdd4a86aa882..8561a32910dd 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3364,16 +3364,16 @@ static void early_kmem_cache_node_alloc(int node) n = page->freelist; BUG_ON(!n); - page->freelist = get_freepointer(kmem_cache_node, n); - page->inuse = 1; - page->frozen = 0; - kmem_cache_node->node[node] = n; #ifdef CONFIG_SLUB_DEBUG init_object(kmem_cache_node, n, SLUB_RED_ACTIVE); init_tracking(kmem_cache_node, n); #endif - kasan_kmalloc(kmem_cache_node, n, sizeof(struct kmem_cache_node), + n = kasan_kmalloc(kmem_cache_node, n, sizeof(struct kmem_cache_node), GFP_KERNEL); + page->freelist = get_freepointer(kmem_cache_node, n); + page->inuse = 1; + page->frozen = 0; + kmem_cache_node->node[node] = n; init_kmem_cache_node(n); inc_slabs_node(kmem_cache_node, node, page->objects); -- 2.20.0.rc0.387.gc7a69e6b6c-goog