Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10635627imu; Thu, 6 Dec 2018 04:29:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQ85cclX1yIiUdhdsVD1Ie8XocizafGd5FGZi6OCfmj7Lpb9rD2bO2kLHCdwSS+KrqCobR X-Received: by 2002:a63:f658:: with SMTP id u24mr24016601pgj.267.1544099348242; Thu, 06 Dec 2018 04:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544099348; cv=none; d=google.com; s=arc-20160816; b=Ai9QVBxmv05ogWbWVojfLKtIGAqUCgnpD+0IIRz6kNMsAo+a41YZUsdSRg2/REu9yB vayn5Ap3MFn9BZkNzSIXt1zrQSi2WB+gksG59TqSzbOTcmdq1fFhn2XjrCMgB74wfYnm aEMvzIChSYP2DklP0FdpyAloEBqXQMph296AnmYHcvfductMIHiJ9TsW3RkJSDWYNbir nJ/TR+Lispe7+kkloIRw2M41MJscVXH8CV40ExbfPGdOeQ/YTuFdOOhcmy8+3Ekffw31 LpOZE5oR3WBQzKgHWnfU+Nb3toP7BIvppzde4hXIthaygr79lMQkVDgHVF25Y7b5ozVN lHQA== 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=QE+Q4nZZeBuS5Au8e+/piROKf4cgt6sP42L8SlWJEXM=; b=SipFBkzxsPc6sYFlARJxvGpQdzm9muXQ1IOu+lyYq7MaEZyqFcf1b/EqlEIyGCXLn8 QZkp4jYK4Hg1dTE98kQAHjNuRZjS00UbWJvnSCrpDG2Cx9NfyvCGg3oFqD7YeDlgKz6G LMM0hDqUvYrPzicijXG5CqqrzogbL/CFekmlZS8R+nfneun8sUk9yujRrE+Z2ORR9oZn pBqAMvNzMHkdI4fMyO5XoCuD7joA9uRxWA2osjF8bAGySgDXEK+EilT7J7hus09C9BeY tcpDvqeHXeLfYIStgOIfjIwc/1plztHYjvqIjabeObpAAKEo/j92pJhcT6dTAUjOR94e jbZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wVfJoDn2; 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 k20si178423pfb.215.2018.12.06.04.28.52; Thu, 06 Dec 2018 04:29:08 -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=wVfJoDn2; 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 S1729540AbeLFMYz (ORCPT + 99 others); Thu, 6 Dec 2018 07:24:55 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44733 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbeLFMYw (ORCPT ); Thu, 6 Dec 2018 07:24:52 -0500 Received: by mail-wr1-f65.google.com with SMTP id z5so259289wrt.11 for ; Thu, 06 Dec 2018 04:24:51 -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=QE+Q4nZZeBuS5Au8e+/piROKf4cgt6sP42L8SlWJEXM=; b=wVfJoDn2JNGToLJ7T1uR10yBYoDyUvZHDPfnc33migagJxNgK+X3SnnMPkKaXVWcF5 v6DU0pyjTpUKWwu0GEPHwrHDIrKhpC24bXdBcz+YJcAfaB/02+ok4ph+SNNgl1+MJDM4 2PaoZbYfH88/GrmDHUvLd2wPovhStnou6VwHZqIxFuXbq1dEWnuoMs68mCqn/3V8dT/m r/FsTY+w6qZiGf1nry8kOTCuRubMXKayBenfsABcza7lF8t6/ApNTC0pVXwtJVEzfn/w 2gGTTyhI6k4TX6dIeS1j4PSmYrg9rFHuvrEsBSU5NzDgCEnyQyIViFt+X8uGtgGXYdIf dcIw== 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=QE+Q4nZZeBuS5Au8e+/piROKf4cgt6sP42L8SlWJEXM=; b=op+JNDhojwF6m+j+3PdFM6ZOcyiYEjXsyP7OU5AGuNqOoCDuwMeETDWUX74CLFjG5x atGGbtxisi+S3Sm1nfPQCqzfPhrO6FMH4kYOVQvPtxR70YXyREYckGT0UTy1S0zh44vf ww/uGSwR2oaCf0kBl7T0NYCIAI+tqSJSv0gKmYhV7iojA3d8Fprf2TwdhBiszRpEg62J ssUBFbCFKqcjFphBZrConR+wDsVOB/hdm2AigKGRIc2RKBN7YCoBIcOE3TI0memJF37h IJ2BndKIbhRA0WS9hyjtdaNmwMyIliROpMWMl1E5XECmsoUg6/yhEtFSLQiYSEY6x0w0 Bzwg== X-Gm-Message-State: AA+aEWbTj9YX0rY0uDvBEoLOyIRwjNZ70P4aN1qAKydYySFapNN23CsJ KtCshVztx4SdxSxI5OjKpygmqA== X-Received: by 2002:adf:f091:: with SMTP id n17mr9677058wro.292.1544099090436; Thu, 06 Dec 2018 04:24:50 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id j8sm339988wrt.40.2018.12.06.04.24.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 04:24:49 -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 v13 02/25] kasan, slub: handle pointer tags in early_kmem_cache_node_alloc Date: Thu, 6 Dec 2018 13:24:20 +0100 Message-Id: X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-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.rc1.387.gf8505762e3-goog