Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2316487rdb; Tue, 3 Oct 2023 18:27:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+0ucipDLK2Y5+/e03Rnudxqmz5DBMgkkkbVako2U6COm3gGL0+V/6F7+GRWe2d2CAhQf/ X-Received: by 2002:a25:3208:0:b0:d81:bb7e:f49d with SMTP id y8-20020a253208000000b00d81bb7ef49dmr910696yby.43.1696382860390; Tue, 03 Oct 2023 18:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696382860; cv=none; d=google.com; s=arc-20160816; b=xyP/VV+0brCRs3FNaGVma8WvbIfwq/toHMgMDJU6RApmrtC2RNfqcRtmyquRq8I9Yj m4TiOEej0e4NaiHZ6KGf04Dk4nW8B+rim3LtBOFocr3T+ZINUeGTYupRgOKuCqj7bT6B mKyd6IiXQf3m7+k0fcO+33JO+Bn3CJ4fDzNyg+10hfwlsQxrHbzotm3T32QIhcDiLqka HyMPElDOYcmTWEAddfMRrTjRy9xIKTOcC+vNzZYMbbLUMv1Kx9o43XwxgzohFt9DiucJ GEiNxHqfjCV2OGXBub7CDjBlODza+tJyJFAru5OPAYjcpxK9srLGzJYjbXAbuqf1Uh8v SAmw== 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=d2/Stkv9VLg2wJLZPjebtJewn8INIKWkXmd/nHJAsIU=; fh=P86bVfuw7HXCsVmxJePmX4hCSchcuVccD9KQJa2UgAA=; b=gJpMQzRZCnxF+SNJdCF88Xnlt4irtqeSClvCU9ZNYcsTo+CI61OUFcXRjs+/rdQRxU ykxp/a9x8JjGaW0+bL/a4UyX9bOKc+66RX8a4ldcImcIqha3l83WkeoQ337tEAsXVGRh WnQFbe+cFBQoQ/lE6ASPb8QXnERhgnzsaezZKFhxfv20FKWpu6GGySOIgvhWg9yNA+qM 0Scql+gwdw3Bo61evr47Z81CDuQsxLO3yTkidy8PVnCrngFYOFYaq7fWPskV6liWMdML P/T8mUC+XTrynhw63WqbV5ufcxtUPsE+TNkNu2bjSgiNE4WneyEXDx7NZG7u6RerRGDJ Z9vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vHH6otbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i189-20020a639dc6000000b00578afd89ba6si2597038pgd.457.2023.10.03.18.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 18:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vHH6otbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8ED1C82DFD0A; Tue, 3 Oct 2023 18:27:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239531AbjJDB1a (ORCPT + 99 others); Tue, 3 Oct 2023 21:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232430AbjJDB13 (ORCPT ); Tue, 3 Oct 2023 21:27:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EF3AB for ; Tue, 3 Oct 2023 18:27:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E20F2C433C7; Wed, 4 Oct 2023 01:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696382845; bh=yTvWR13RSP/MZoj7Q5M+5eAsbvb/Cb/re1TdaZF6QWU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vHH6otbNjUX0863bHcWAejSkNzIOQ4rj+9+2Vtwj1mlrLp3WIsZ133c/rfOuX9c4C l2tS3XKKzC/44nAb34iTO9c4lLOYFIoe8/AxMxqPhfCfuDK0KfAV6YYqjt1ft99Rte QHvr3FgHJgnTtkONH/hyDj1Om9EMzDLsMYfcYtYqzCpQ6gi7USBYoZQPSW+V0Tf/Xa 4srsD8x5VNqxa2/xQYBhBlNSrezvf6bBOB37XkUZVnR3f0jQTDcIzN2m/hBOHBhp/z JihsP5EKpk8Ag1/druZzyAQrUDIg0XMaNmYrOXHIJbHlRHWvgQ61AQYi8f7UsPb9XQ at2st+eLwJ4Vg== Date: Wed, 4 Oct 2023 10:27:22 +0900 From: Masami Hiramatsu (Google) To: Alexandre Ghiti Cc: Steven Rostedt , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sami Tolvanen , Kees Cook , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH -fixes] riscv: Fix ftrace syscall handling which are now prefixed with __riscv_ Message-Id: <20231004102722.7baddc2a0e4969afffb55eed@kernel.org> In-Reply-To: <20231003182407.32198-1-alexghiti@rivosinc.com> References: <20231003182407.32198-1-alexghiti@rivosinc.com> 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=-5.5 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_MED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 18:27:39 -0700 (PDT) On Tue, 3 Oct 2023 20:24:07 +0200 Alexandre Ghiti wrote: > ftrace creates entries for each syscall in the tracefs but has failed > since commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") which > prefixes all riscv syscalls with __riscv_. > > So fix this by implementing arch_syscall_match_sym_name() which allows us > to ignore this prefix. > > And also ignore compat syscalls like x86/arm64 by implementing > arch_trace_is_compat_syscall(). > Looks good to me, Acked-by: Masami Hiramatsu (Google) Thank you, > Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers") > Signed-off-by: Alexandre Ghiti > --- > arch/riscv/include/asm/ftrace.h | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h > index 740a979171e5..2b2f5df7ef2c 100644 > --- a/arch/riscv/include/asm/ftrace.h > +++ b/arch/riscv/include/asm/ftrace.h > @@ -31,6 +31,27 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) > return addr; > } > > +/* > + * Let's do like x86/arm64 and ignore the compat syscalls. > + */ > +#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS > +static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) > +{ > + return is_compat_task(); > +} > + > +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME > +static inline bool arch_syscall_match_sym_name(const char *sym, > + const char *name) > +{ > + /* > + * Since all syscall functions have __riscv_ prefix, we must skip it. > + * However, as we described above, we decided to ignore compat > + * syscalls, so we don't care about __riscv_compat_ prefix here. > + */ > + return !strcmp(sym + 8, name); > +} > + > struct dyn_arch_ftrace { > }; > #endif > -- > 2.39.2 > -- Masami Hiramatsu (Google)