Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp539791imu; Thu, 20 Dec 2018 00:57:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wb29HqVDp8Xq7/zNDqdyXOPkxNbo7VuKhIch/Q3HeP8zqHAcF6cOneehBhAgtb72n1pAcE X-Received: by 2002:a63:d604:: with SMTP id q4mr22002798pgg.175.1545296249722; Thu, 20 Dec 2018 00:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545296249; cv=none; d=google.com; s=arc-20160816; b=nPRM5CO9uZ0gFph5utj+DbFh3Lv6+nxKKBBN4Hqtqb13uMw+pc+1X21w2UpbZ3YFiB OD41CvJsfwyALRralclMmlWjl4++AmBaWlyaFZDRGumH7Bys+8SMLULwbJfuy0M9g012 Xp9FnyT0ODl7NjLEs+Q+PyQmO5Kq87cGpRzt3Xt7m4FgXlRNqdLuXobDoweo+9xtmhqC 2j//oLwFR7TYmWFdndmLBAzIsff9uPrI0+NRgb+H5Inlanm8WObKW+e4U6R75/EwTo/Q 31F2hSxkxOOySzNlax8kS6uXcr3Vl8TBN5Oa0Uub1hqtxdFVLWs8GPPqYO07JJyQm9t9 bF3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=4f//ZuqHyfIpkisIdRIVPt6dJpP6ZUTDId67nliL1O4=; b=awCDeRwXnoID2ecd3o6YFFmVujqxPwYs1RQevJj+jilsXFwwHBopOMGaEk/RMZGiQ9 cL++jnWYKxC6/wfT5/C/+Qcf1Q3wo/E6Ez5LfgDikKebdxshsIVorGQZuVORPw3a/BNF nFTaOYTuM67As+ipiyfnmf7dW+GJwukgfC3gCEB8OGXytTW0qLYDndl/sLiNZx7QOkXY N1PWLknT7i0mmrZQJK4js/ehNkrSyeR3sBEZiW/RiQUHTvvsS5MUNlM8ul74A+8KL0PQ +aoiOOK9GQIJvsM90RnZEGeqqbKvntllqyVPTQ6aLn4GM3KY9UFBaYVnXommaejs6SLE 6UVg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si17317178pgy.174.2018.12.20.00.57.14; Thu, 20 Dec 2018 00:57:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729217AbeLTGkk (ORCPT + 99 others); Thu, 20 Dec 2018 01:40:40 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:36565 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbeLTGki (ORCPT ); Thu, 20 Dec 2018 01:40:38 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43L2Fb6GPXz9vBJf; Thu, 20 Dec 2018 07:40:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id d8bPf8iozh3q; Thu, 20 Dec 2018 07:40:35 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43L2Fb5nhPz9vB1r; Thu, 20 Dec 2018 07:40:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A63338B796; Thu, 20 Dec 2018 07:40:36 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0ZEHRBIZ2AOo; Thu, 20 Dec 2018 07:40:36 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 77D5C8B755; Thu, 20 Dec 2018 07:40:36 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 55EF371733; Thu, 20 Dec 2018 06:40:36 +0000 (UTC) Message-Id: <55ad0e6a00ba8abc008664fa8e367c1e2ce1f4cd.1545287470.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v2 1/3] powerpc/mm: prepare kernel for KAsan on PPC32 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com, aneesh.kumar@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 20 Dec 2018 06:40:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In kernel/cputable.c, explicitly use memcpy() in order to allow GCC to replace it with __memcpy() when KASAN is selected. Since commit 400c47d81ca38 ("powerpc32: memset: only use dcbz once cache is enabled"), memset() can be used before activation of the cache, so no need to use memset_io() for zeroing the BSS. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/cputable.c | 4 ++-- arch/powerpc/kernel/setup_32.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 2da01340c84c..9ea031b05f19 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -2145,7 +2145,7 @@ void __init set_cur_cpu_spec(struct cpu_spec *s) struct cpu_spec *t = &the_cpu_spec; t = PTRRELOC(t); - *t = *s; + memcpy(t, s, sizeof(*t)); *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec; } @@ -2160,7 +2160,7 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset, old = *t; /* Copy everything, then do fixups */ - *t = *s; + memcpy(t, s, sizeof(*t)); /* * If we are overriding a previous value derived from the real diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 972c98d1e208..00b8f54fed29 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -74,10 +74,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr) { unsigned long offset = reloc_offset(); - /* First zero the BSS -- use memset_io, some platforms don't have - * caches on yet */ - memset_io((void __iomem *)PTRRELOC(&__bss_start), 0, - __bss_stop - __bss_start); + /* First zero the BSS */ + memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); /* * Identify the CPU type and fix up code sections -- 2.13.3