From patchwork Fri Jul 13 16:23:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 10523783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9B248601C2 for ; Fri, 13 Jul 2018 16:23:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BB61286DB for ; Fri, 13 Jul 2018 16:23:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8979529D63; Fri, 13 Jul 2018 16:23:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C9D2286DB for ; Fri, 13 Jul 2018 16:23:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42DC66B000C; Fri, 13 Jul 2018 12:23:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3E03B6B000D; Fri, 13 Jul 2018 12:23:34 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 259E76B000E; Fri, 13 Jul 2018 12:23:34 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id BF6FA6B000C for ; Fri, 13 Jul 2018 12:23:33 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id t83-v6so6423200wmt.3 for ; Fri, 13 Jul 2018 09:23:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :in-reply-to:references:from:subject:to:cc:date; bh=ge3V/aKCs80Zt22rUxM+dIYm3pXEss0OuTft4NrWz+o=; b=dojyjOfMyy4qdZsTIPnFqvVflQ+vSV1rhWbW4eylFR4ZqSyRqPfoVBzPhYvl89fZhK FFEcaHAU6pld0+VYw1Z9Z3uETV+OkCpeaLAhXprZvEkCrV/NEoBc8mGydtilQMoOV3tw hxolWXQE3IeNFSIAHto9L5kG6MixPerEncgLAL58cU+nIkdwKTs9ceRAe19b5fGZrPQU 3nfP9aOGV7L15AwJ7koEYrZd4r62XqV2gdELtrHRQ2+nzI84XEbkJfixfp+5nPvMVV8Q 6FVbtceo7Af7pabDdZQqAET6yLQXFPfkMzKUEEMkn5rLj9H1gw/FG5mgq2XoH37nDYl/ 09Ow== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr X-Gm-Message-State: AOUpUlHsKFPIiLEaRNIoN3YwpNBqL9GXKDHiaDpnzL1GR8qsghPC1P8q +Jl9toZr45MU5gmXNeSu80Ws2ZDIhflWr7f9uoo794ywHcLJYLLmalX9QXD7Nd+Cgtivlamd8Ns sR+gmWedprlquWSWj8TN/D5EXAuC97oqjlReR72PF45/ooGvtJ6+ASpS1etIhLJvSew== X-Received: by 2002:a1c:2442:: with SMTP id k63-v6mr4121351wmk.7.1531499013349; Fri, 13 Jul 2018 09:23:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf0tD4WHhd/AiOvvhHj1gFOf/tmvjJPtAf7uuUqVOGBdksEiijvh17Uv/iHTID0ww9nGO5r X-Received: by 2002:a1c:2442:: with SMTP id k63-v6mr4121324wmk.7.1531499012658; Fri, 13 Jul 2018 09:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531499012; cv=none; d=google.com; s=arc-20160816; b=PHBT2SMij0SsLw3Zv4r6tAvy5VQNbxV1916CYEn1lA1Hpy3mEp8Lf985vfkulbzDZ0 ssoN/gUlJOa/34fi17FIsBxrV4w0y8KTaVNRdJIsD6PnDWX3ws0ESdll9bgYDIttZ/GZ +42ej7gUSpmD+4lHvDtLIOoN3Ju7D4jR8nW7vuKVnPQ6N1yAmLNBS6bU9FbVOb2QRIT9 6PvLM62x22r4Q9Vr3Q2wXcqVgqQbKpAAwp05r6v7DSuq+sTGO81xO0IpQ4fJAEnNev3N jt82+IJyKZ8BLuGNsemdS2AJKY/x4DbY8LWfHl8xN5WTenU4AnYbrEjPnmhaTZfbQ8N6 4P2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:cc:to:subject:from:references:in-reply-to:message-id :arc-authentication-results; bh=ge3V/aKCs80Zt22rUxM+dIYm3pXEss0OuTft4NrWz+o=; b=zsuBAdp9MzHYvI+frQBa6VwDdhWhrZD2aAkQhAfxkzDsAvYz6l6yC1uTPqegNI3dxH kGi1YJaXmxTKHNJ0u2JAILncMMNeXLoi2+H3djlmsN1tD+sQNEjmQr3vOl3EB2T7zeXG wyDBfiV+lfoIDH2M1amWkXzKLFgIVb8F7OYMUytfIuyQVb4TjKgaNX6kSQd3YxTFTN/l O2emxkVq/tLCMPsKP7UqDqED5ng8fchY56N+DR4kJIGyoLWrkQ4/grjAZWasKT73YMHl pAuwlpim2ThgAjCod+4AxxKhK0OV0MzWLWJjqq0X3lX918UoT14bwZkZfrUSTA5+HYeu TzYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from pegase1.c-s.fr (pegase1.c-s.fr. [93.17.236.30]) by mx.google.com with ESMTPS id y124-v6si5101341wmy.141.2018.07.13.09.23.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 09:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) client-ip=93.17.236.30; Authentication-Results: mx.google.com; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 41Ryll6XRnz9ttkk; Fri, 13 Jul 2018 18:23:15 +0200 (CEST) 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 BoCYi_xzgsy5; Fri, 13 Jul 2018 18:23:15 +0200 (CEST) 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 41Ryll5SMYz9ttCT; Fri, 13 Jul 2018 18:23:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 012C48B8A8; Fri, 13 Jul 2018 18:23:32 +0200 (CEST) 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 BcAlP_tL5aw3; Fri, 13 Jul 2018 18:23:31 +0200 (CEST) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.4]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D7A318B75A; Fri, 13 Jul 2018 18:23:31 +0200 (CEST) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id CF300711EC; Fri, 13 Jul 2018 16:23:31 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v1 1/4] 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, linux-mm@kvack.org Date: Fri, 13 Jul 2018 16:23:31 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 c8fc9691f8c7..60ee5900bf12 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -2183,7 +2183,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; } @@ -2198,7 +2198,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 74457485574b..6a394b9e109e 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -70,10 +70,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