Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1379838pxb; Thu, 4 Mar 2021 09:49:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxYCZNnXPsZWcGonSQpxnuf4yGjUUfWyM0W+ZtG28KkuXBS4PBF0tdz2H8nlXX1gnGp/kP X-Received: by 2002:a05:6402:35c8:: with SMTP id z8mr5691515edc.341.1614880149843; Thu, 04 Mar 2021 09:49:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614880149; cv=none; d=google.com; s=arc-20160816; b=rTLoT462NDa2cQDJlWSs7g6/oPuJcp0H7WuUcbuXyzOIIxHrQmMWp5FswpyiglV2Ou VTm/hjAgLs3stE5HdRcPcIeXy+jCdFKx9Z/skiEdH40h6bX4qER5jRjjL6+TWYec/veQ pDkPsASSw8QWxNZUUuCWHTQy0AZIMeyPKQ2bbBniurUKY8QrZMF/2aAg7hjDjphV+6bX miy4ssfh5u6IHCsYtKoKo0JRD2z8a54Kh7HwM8qVRLc8VMfX3/FScI+WHwKBIMCnQts3 AaWhEJX49N8vr6nCT5Dh/vaIbUsPVpLewiw5Bd/Af2W82q5hqxQjmkkX1zLkbD9RfoQx 1UwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=B6t/iRhxaz6mIiZvKsR4Ph8NTlJXLnsmBsm+Fu3vxVg=; b=WQS7eKHW+uU909FCJ4F/jF/Xt/cSB+3QA8V9cH96LkcnsoOzRoCkFUS5zDawtHzCjD GFVDqcLFV9/vqcNKW3PPCJfrQjdISYXb15LaKL40B3I0lo6tBASIEpIcCpPA4tNeASrF R0NSa+Pqd+Uz0Oc97uzD7mc0p1GSWH2qZtV2c+YJmsLAkuRobVjDP0P1Tw8wymHspKW+ pLGU41RyAp0650XCLRIjVRvetUiRBstn23q6iWeF46BOuxO3NoRrWzoNrJahc6Bo/aLH zGP/IhxPFBOqc9+aWHRNA0TIoXrg2tBiAZ0JiWTEK3vGTbvzQeESGbDpL9d5nPt8Htg+ eY3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=quhqijAS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si61004edj.492.2021.03.04.09.48.46; Thu, 04 Mar 2021 09:49:09 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=quhqijAS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238601AbhCDOUh (ORCPT + 99 others); Thu, 4 Mar 2021 09:20:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232448AbhCDOUY (ORCPT ); Thu, 4 Mar 2021 09:20:24 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE444C06175F for ; Thu, 4 Mar 2021 06:19:43 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id a13so30260386oid.0 for ; Thu, 04 Mar 2021 06:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=B6t/iRhxaz6mIiZvKsR4Ph8NTlJXLnsmBsm+Fu3vxVg=; b=quhqijAStrtqg5ulDL8MGpWooN+jj/XfkXFrXOHChG+J0Oemh8uM8ai2LV5B+F6Eut r8V4BpaHEpFUfLTqPIN+90zfn75GVB3k0S/oQAv2I+Aw36bQ9iYBhAe+h2AZUck6BymN VwzSaRmrFMQbf62lgTkidT+fkQ1A0ZZNFOMoopUMlCyOegUrN64rTDSKe1hk7NmpGZ/+ LsIH6tMgoMpp443DS38ej45RsxzE4oDVXFJnKxX3RW1Qz28u3eivry7XYwcQnsA9kcII /H4U+uebWqVm2SL79rMMbIUHw8/AZI8KS4A2yT6RZxp1RcCvIkpGXXXZtMYISNt42k17 AAuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=B6t/iRhxaz6mIiZvKsR4Ph8NTlJXLnsmBsm+Fu3vxVg=; b=hVL432nGQS5uJ7OJgjTm+Qph6TpN9crZyKFPtlBcCNjpa5BAgoQGFTt6+VQdEHeB4z 0BBjVb+Kjih3TbAHIStFyYjMXSGlMtLzGk/WI8ZU1+2DWRWojFHsskNkkPaFge9s/s+6 1ylRAMERyJJAQZNC5VjagWh4Ya7jqzx4T3BpLSmTVIdvuIKnqylTQSPHa6RCSO+juiC2 kFBazb/yFfqGS+bY++BITZnUpGiuDU8zi6u0wZMj7tJ3dKK2zMSYfojGLHLFnrp6P5Q+ T/Tw0ScJxXC7UU+2y9FLTqN84QHBNYjV/NXNbPI47k7QFHcDtFjl917R4toewotLiDjo 3wxw== X-Gm-Message-State: AOAM530+oslmRgglQo/CjEE7jit5To+8lYYH5dtTbZCEKN89QKUgwfQl 88TpkgSI5zHNTFOqzu2DvvMyrjmitbuyXGLZC9oxJA== X-Received: by 2002:aca:d515:: with SMTP id m21mr3162609oig.172.1614867583032; Thu, 04 Mar 2021 06:19:43 -0800 (PST) MIME-Version: 1.0 References: <08a96c5d-4ae7-03b4-208f-956226dee6bb@csgroup.eu> <7270e1cc-bb6b-99ee-0043-08a027b8d83a@csgroup.eu> <4b46ecc9-ae47-eee1-843e-e0638a356b51@csgroup.eu> In-Reply-To: <4b46ecc9-ae47-eee1-843e-e0638a356b51@csgroup.eu> From: Marco Elver Date: Thu, 4 Mar 2021 15:19:31 +0100 Message-ID: Subject: Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32 To: Christophe Leroy Cc: Alexander Potapenko , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dmitry Vyukov , LKML , linuxppc-dev@lists.ozlabs.org, kasan-dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Mar 2021 at 15:08, Christophe Leroy wrote: > > > > Le 04/03/2021 =C3=A0 13:48, Marco Elver a =C3=A9crit : > > 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 exis= t > > > > 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@cs= group.eu > > Reported-by: Christophe Leroy > > Signed-off-by: Marco Elver > > Tested-by: Christophe Leroy Thanks, I'll send this to Andrew for inclusion in -mm, since this is not a strict dependency (it'll work without the patch, just the stack traces aren't that pretty but still useful). If the ppc patches and this make it into the next merge window, everything should be good for 5.13. > > --- > > 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 =3D 0; skipnr < num_entries; skipnr++) { > > int len =3D scnprintf(buf, sizeof(buf), "%ps", (void *)st= ack_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 sta= ck_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_allo= c")) > > goto found; > > } > > if (fallback < num_entries) > >