From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F18932F54AF; Mon, 5 May 2025 23:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746486993; cv=none; b=jlI+rGkMOOuAAq57TzCxQOPFTFrc77lyA6NgZDEgc+QjloWuCphTLA1vpRZHGtKqoFb4CvO8fYPIZwHtNE6bH5W0USOWigWqbVahsDL+O8Ke3sKQWvkS5RHMGSa/U0hD3i1VWqn3B9ntdRGEXcPeQi3YYmyn4uXabHb6wDi+wRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746486993; c=relaxed/simple; bh=4Rhj+XqsDVjOooL4g5+oDRfe5elpg/W4PBMdyfzXDGY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t5UN6cO+DkfWXujvIa9zcPvP/vAoO1OQrmynxk80GyBJEfNyQ5e98vQSMkRscrfIXiVYtoJ6cCuvSaaeVE1eqZyzhd1LDQKNIPauYF2ssHCytj9R6WGCksDfjFIrJJGn0CGe514YFiWiImze5OCYZYLAjlI2cvUJhCGzWhpX1eI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AEnjdhbc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AEnjdhbc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC96C4AF09; Mon, 5 May 2025 23:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746486991; bh=4Rhj+XqsDVjOooL4g5+oDRfe5elpg/W4PBMdyfzXDGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEnjdhbcNWzdC8UCLBskd8csIlPM9zDUYOcPggpZburAzqSsstvRCD2oCetGRMTV1 cofweO6GAZ5zei13MnmuTbvTFAidz1Vshj7icU3aUhRCwKCE9ilZgOLHuT54YUS+bo HGEP/HM5d5yPxGRGjsY0a3SCN/a+ZQ7qIWH9+Tz1oNHyN0LV8DgXes8FpQaFC/IpED dOoYcJq/vRemJv/QKENN/KtteNq1ybAG1FeulxjbXpfpPnBlFGksQnps76FOYsK85e +9/u7e34UhW2+7ZwwLAeQM2pmJ2pT23AZt3G0nNukBeU9hXozgzTU6FdlXWIiwpDxA B1OPVlOsq0sRA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bibo Mao , Thomas Bogendoerfer , Sasha Levin , rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 095/153] MIPS: Use arch specific syscall name match function Date: Mon, 5 May 2025 19:12:22 -0400 Message-Id: <20250505231320.2695319-95-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250505231320.2695319-1-sashal@kernel.org> References: <20250505231320.2695319-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.181 Content-Transfer-Encoding: 8bit From: Bibo Mao [ Upstream commit 756276ce78d5624dc814f9d99f7d16c8fd51076e ] On MIPS system, most of the syscall function name begin with prefix sys_. Some syscalls are special such as clone/fork, function name of these begin with __sys_. Since scratch registers need be saved in stack when these system calls happens. With ftrace system call method, system call functions are declared with SYSCALL_DEFINEx, metadata of the system call symbol name begins with sys_. Here mips specific function arch_syscall_match_sym_name is used to compare function name between sys_call_table[] and metadata of syscall symbol. Signed-off-by: Bibo Mao Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/include/asm/ftrace.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h index db497a8167da2..e3212f44446fa 100644 --- a/arch/mips/include/asm/ftrace.h +++ b/arch/mips/include/asm/ftrace.h @@ -87,4 +87,20 @@ struct dyn_arch_ftrace { #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ + +#ifdef CONFIG_FTRACE_SYSCALLS +#ifndef __ASSEMBLY__ +/* + * Some syscall entry functions on mips start with "__sys_" (fork and clone, + * for instance). We should also match the sys_ variant with those. + */ +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME +static inline bool arch_syscall_match_sym_name(const char *sym, + const char *name) +{ + return !strcmp(sym, name) || + (!strncmp(sym, "__sys_", 6) && !strcmp(sym + 6, name + 4)); +} +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* _ASM_MIPS_FTRACE_H */ -- 2.39.5