Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1379521pxb; Thu, 4 Mar 2021 09:48:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVzPXJlI/6bXmZSbA5NkIgyCyU1jkNWxkXaSupHxlOttogiAga4bbcx8x/F16rFonYMw5X X-Received: by 2002:aa7:c843:: with SMTP id g3mr5777567edt.228.1614880117957; Thu, 04 Mar 2021 09:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614880117; cv=none; d=google.com; s=arc-20160816; b=SmFCs3iSzYCffSu+LmHvSm/1oIdeQI6H4AlUiVmF879CpJD0JNnWNxaQxCH4VkPtM6 MuhPmEofLCTbrRXrHfF2rAZe9UFzREIpCfnKOOrOrIHvHCADKfta5bwrcTo2ymBMmWRK j80K6FOA7Tjw3OF46zg/dj90ZL/aBX1paoa720Lzf/ZRizbYqwY1xorgropld7C7qFqv xED3lOGul6JDOIUT7LDF9ghEYwXU8Fq0Pt8o6DgFZCMaWjRlq63zpJmekVdK1QpW8xB6 DPCT5t+tC54+SgrS4rFGsSmogX29c1RdfzOxa+Y19v1CI3BwgYPq85SvnbqpmXaNp3ii g20A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7w+55pfTVH4wQxX+7+fGj9XRpIuXYUnYYSmvDDuR078=; b=Sz7k+m9MrvUND1sT2+tC19zYGLM+Z6pvAJGiIeRkcRF1IVkWU1Quy866eSGy5n27IS IEvliEoGWVN1KioxLzdLWa6D4P1mae2y3lJ42XeMksO2dl5l16eSdacDBU6+9dC3T1Dp OBTw8gDXuPFJl6YeEuYsEULMyYzSq+49b3mvoeW7FU980LZmb3XpHBEDOiTmaKBYio1h CUa5sBRzeLWTUNS7JLXGBUcWHKNYCh4VXmm7lSoA7BOoUZEbYtpDUloxs7pccjPKx9Q0 3MgC7ACwq1w2/mgtjI7/F4eU3yL2GIU+Yr5FXNbg2mTie+e+bcJ//LKzAPUi4HJHLc0Y m0MQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si54974edd.574.2021.03.04.09.48.14; Thu, 04 Mar 2021 09:48:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbhCDOJ5 (ORCPT + 99 others); Thu, 4 Mar 2021 09:09:57 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:51600 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240164AbhCDOJX (ORCPT ); Thu, 4 Mar 2021 09:09:23 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4Drt4x6GPgz9v4Tn; Thu, 4 Mar 2021 15:08:33 +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 dT301ejb3PY6; Thu, 4 Mar 2021 15:08:33 +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 4Drt4x59X3z9v4Tl; Thu, 4 Mar 2021 15:08:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B7EE28B80A; Thu, 4 Mar 2021 15:08:35 +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 LRqkBOW4SWOI; Thu, 4 Mar 2021 15:08:35 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0DB758B812; Thu, 4 Mar 2021 15:08:35 +0100 (CET) Subject: Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32 To: Marco Elver Cc: Alexander Potapenko , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dmitry Vyukov , LKML , linuxppc-dev@lists.ozlabs.org, kasan-dev References: <08a96c5d-4ae7-03b4-208f-956226dee6bb@csgroup.eu> <7270e1cc-bb6b-99ee-0043-08a027b8d83a@csgroup.eu> From: Christophe Leroy Message-ID: <4b46ecc9-ae47-eee1-843e-e0638a356b51@csgroup.eu> Date: Thu, 4 Mar 2021 15:08:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 04/03/2021 à 13:48, Marco Elver a écrit : > From d118080eb9552073f5dcf1f86198f3d86d5ea850 Mon Sep 17 00:00:00 2001 > From: Marco Elver > Date: Thu, 4 Mar 2021 13:15:51 +0100 > Subject: [PATCH] kfence: fix reports if constant function prefixes exist > > Some architectures prefix all functions with a constant string ('.' on > ppc64). Add ARCH_FUNC_PREFIX, which may optionally be defined in > , so that get_stack_skipnr() can work properly. It works, thanks. > > Link: https://lkml.kernel.org/r/f036c53d-7e81-763c-47f4-6024c6c5f058@csgroup.eu > Reported-by: Christophe Leroy > Signed-off-by: Marco Elver Tested-by: Christophe Leroy > --- > mm/kfence/report.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/mm/kfence/report.c b/mm/kfence/report.c > index 519f037720f5..e3f71451ad9e 100644 > --- a/mm/kfence/report.c > +++ b/mm/kfence/report.c > @@ -20,6 +20,11 @@ > > #include "kfence.h" > > +/* May be overridden by . */ > +#ifndef ARCH_FUNC_PREFIX > +#define ARCH_FUNC_PREFIX "" > +#endif > + > extern bool no_hash_pointers; > > /* Helper function to either print to a seq_file or to console. */ > @@ -67,8 +72,9 @@ static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries > for (skipnr = 0; skipnr < num_entries; skipnr++) { > int len = scnprintf(buf, sizeof(buf), "%ps", (void *)stack_entries[skipnr]); > > - if (str_has_prefix(buf, "kfence_") || str_has_prefix(buf, "__kfence_") || > - !strncmp(buf, "__slab_free", len)) { > + if (str_has_prefix(buf, ARCH_FUNC_PREFIX "kfence_") || > + str_has_prefix(buf, ARCH_FUNC_PREFIX "__kfence_") || > + !strncmp(buf, ARCH_FUNC_PREFIX "__slab_free", len)) { > /* > * In case of tail calls from any of the below > * to any of the above. > @@ -77,10 +83,10 @@ static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries > } > > /* Also the *_bulk() variants by only checking prefixes. */ > - if (str_has_prefix(buf, "kfree") || > - str_has_prefix(buf, "kmem_cache_free") || > - str_has_prefix(buf, "__kmalloc") || > - str_has_prefix(buf, "kmem_cache_alloc")) > + if (str_has_prefix(buf, ARCH_FUNC_PREFIX "kfree") || > + str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_free") || > + str_has_prefix(buf, ARCH_FUNC_PREFIX "__kmalloc") || > + str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_alloc")) > goto found; > } > if (fallback < num_entries) >