Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36059762rwd; Mon, 10 Jul 2023 17:25:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlFX8CgGRQPLnJPIfH2PID3a6OxJubvw/vHB4eRgRSFYTfnjV9iqotqfgAR5Bjm3tAsfIqfp X-Received: by 2002:a17:903:11c9:b0:1a1:d54b:71df with SMTP id q9-20020a17090311c900b001a1d54b71dfmr20012331plh.0.1689035109246; Mon, 10 Jul 2023 17:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689035109; cv=none; d=google.com; s=arc-20160816; b=tIc+5S6IYe6ny6suuVGMepL23tKewA+5GOvC9P9fobGlGddI18J63gm9YTAWXtnhBH GmI6kx5mNV+V+sl41z/yhz0otWJTgFiy4k5kO8ELyGLJXhHbGiBjF1t3CRPuHRBi/Zhg eUOA20D5C+/J2rlBRiuULQgWP+DPtUX86Ax1CF8yTxcTDO0DNbU+Der6Rx/hZ65byJWc eDRLKrqvD/5SJ6POt+6aGyW+ka/C2CvbsHxngEjIEU8Bae/H03U0mg3fImFkI7Ukv4d7 teVRdPppeJ9KGl3Gl1EO4bApkPYLRUS7KSeVUeCTG9NqXpfjboxMI18miAWSMU7pttAp sf4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=v0VAEqgMqDVYHgPEx1EpCDmaBfpH7rYXgvsz3GfVPBE=; fh=fdP2Ov9YAcGJYDMYkq0Fasc5MLTSzAujd1O37HFULCY=; b=yRJAg4VE4aOCQFIlylUWsqkpgfXQsmC2NnNF562Wqggne8evZZX/5Wg/JKV69BFTD7 bsrAUbJtHemPxShoTTH3kMVHFr//TFvi8kQZelWN2jknCjtHMI+9Ef4dWGG6QJxwaW0N c4nPmFzS3eVOcLV31BkATI736F58LUZhmQH6z+i5GS9Qx2QSfzbjqlDrGr00lALgZje3 v5BF3g4c1qxiWWoxb1Ib22hxB3nsGvh+F47Od2G2v4Wx+GAGbUocvNA3UAZ0CHw7yFg/ 7A0TfC7QHKKxLgXGce3sbMSXKId3Ch8WkE7NsDuNB+WrWo2aPBDhPrF94FkQ2Dczh1zX 9u6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cze55vC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a17090311c800b001b53c722c3fsi621402plh.597.2023.07.10.17.24.57; Mon, 10 Jul 2023 17:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cze55vC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjGJXua (ORCPT + 99 others); Mon, 10 Jul 2023 19:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjGJXu1 (ORCPT ); Mon, 10 Jul 2023 19:50:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80641A2; Mon, 10 Jul 2023 16:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63141611A5; Mon, 10 Jul 2023 23:50:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA55AC433C8; Mon, 10 Jul 2023 23:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689033025; bh=VD/tpU/eNJTlw2/chOqcbgRdtXfwm4YHsFrm91jQzac=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Cze55vC2yZSvF5pub95qzYvtk3UPQNfgCU3ha3zsUHm1x4WsN1QC/DvOvDq+g3bjt FT5wvi6c2jJhtKixMWJqIvcDI2J0bSGcsz6Q5xF7RKwvbzzOAB3xHPiOtuy1t5UiGX 9LhvtoMfupbyF8y6GgPGmq/fjwFzMBHhq3MDuYk1UAO3crqEw6dPaqASuA/WRpmeYN wTK9MDtwxfrP2VIxVlxNLcwATSEqamRJFKQcVGllWno7J3Rbxup/ObGMlszPkEKfb0 3JdTE7tpeLnNn8hioJFaNIWcs1jqNe+gg4klBvrSx+vt0O46bBWp/YiiIrrscD4DBW H7kGHkqF1VyaA== Date: Tue, 11 Jul 2023 08:50:21 +0900 From: Masami Hiramatsu (Google) To: Peter Zijlstra Cc: Petr Pavlu , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, samitolvanen@google.com, x86@kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/2] kprobes: Prohibit probing on CFI preamble symbol Message-Id: <20230711085021.9b32eeaac1070439bae0b8a8@kernel.org> In-Reply-To: <20230710153724.GA3040258@hirez.programming.kicks-ass.net> References: <168899125356.80889.17967397360941194229.stgit@devnote2> <168899126450.80889.16200438320430187434.stgit@devnote2> <20230710153724.GA3040258@hirez.programming.kicks-ass.net> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Jul 2023 17:37:24 +0200 Peter Zijlstra wrote: > On Mon, Jul 10, 2023 at 09:14:24PM +0900, Masami Hiramatsu (Google) wrote: > > > > +#ifdef CONFIG_CFI_CLANG > > +static bool is_cfi_preamble_symbol(unsigned long addr) > > +{ > > + char symbuf[KSYM_NAME_LEN]; > > + > > + if (lookup_symbol_name(addr, symbuf)) > > + return false; > > + > > + return str_has_prefix("__cfi_", symbuf) > || str_has_prefix("__pfx_", symbol); > > The __pfx_ symbols can happen when !CFI_CLANG but still having > FUNCTION_PADDING_BYTES. Indeed. Currently __pfx is not probed via tracefs interface because it is notrace function but kprobe itself should also prohibit that. > > > +} > > +#else > > +#define is_cfi_preamble_symbol(addr) (0) > > +#endif > > As such I think we can do the above unconditionally, without either > there should not be any matching symbols. OK. Thank you! > -- Masami Hiramatsu (Google)