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 5409B2ECE41; Mon, 5 May 2025 23:10:41 +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=1746486642; cv=none; b=SVBs4gOWLKCQ27poj/1pInX+obZC8D2NMwmjx1hB2aI16Vwi9kurizWpGKQNdMF2Zp/JTqwF1OB09H7f1dHNytB7kP0BiD3n0F+kSsCiw//H6WemKnduMEm7/WF5r/DWHU4twCYvvGr68LOqJTsVxqvZt7yduzXrUtUsUzLTHnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746486642; c=relaxed/simple; bh=4Rhj+XqsDVjOooL4g5+oDRfe5elpg/W4PBMdyfzXDGY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cPuXrA+sHMHodgPjZ3n8I79WqtAPW2Ql/7zEWn+jfFKTIs3X6Gr0j7J14lkcQp59jZ0QDgf9FZmOsGDFSk706AiekqyUpEungDCa6U1+bEzabdPPBmiBqExdqJN/hwugpe6OiVZZcVnEEDlNWROG2HtOVw3JFRhitl2LUBIrBs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n/N+Ij3F; 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="n/N+Ij3F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31262C4CEE4; Mon, 5 May 2025 23:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746486641; bh=4Rhj+XqsDVjOooL4g5+oDRfe5elpg/W4PBMdyfzXDGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/N+Ij3Fk/ZU6LtXzY3rfbMwtu88UBCMz59keIKivyirHzSMTbvJmQko6SniIdqhx us0Hiomq8FHP8APgMYv3bki2mSzKv5XicAa39064Fb4OjJBeRR6cKUIkZeNfGDIh5H Ngzo/llzJLkkWBsaEm3cCicvNOEFTpPt++R97elRN6CTEqJr0niKLjA2aMhXNBkcjN fQMyf8fgKN+OYUgaxqoPksmqyPzzZkrLVBaiqFXGX6t6Pp/rofTtLO3FA8C9nP9BkC uo6JYuBIWlIFJgIAzE6nTCEFyAXEBWyxncTGPJJ+MuQr33nvoZ7kPuJbKuox7cALxA 31o4qgCQWeUCA== 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 6.1 131/212] MIPS: Use arch specific syscall name match function Date: Mon, 5 May 2025 19:05:03 -0400 Message-Id: <20250505230624.2692522-131-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250505230624.2692522-1-sashal@kernel.org> References: <20250505230624.2692522-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.136 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