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 065381A4F12; Mon, 2 Jun 2025 14:46:39 +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=1748875599; cv=none; b=gjARGMLgVwWvP1JY5MuSfAIV9VkK0FNy92KckMRMxodeq6j2QnfxBoitC0Ziok9KwJgXCiTZf9ex66CShw3SrB3EX7zM2GwuOjV1g20llcjZAWMSk8WPgwonMCAt2ZhJt7BAxQA0dyKvJL16GlVfSc1EZ6itXHn14fH7j4GVkk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748875599; c=relaxed/simple; bh=UIBVo/CWmB6ZkIMx+IJOkAf5JPwrhHWZWGk2m5ANiNI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QU6hXJP0dKNw4luZ37HFC/rpRC3BcINTdgkx0zRCeVIgBKobfCyAkrlnWOiZh9mGrcP0tqHmeEM64XS/iN2TOwG9mHSjOsHL4vKibziWtq4YyQNeml/lDWBYbv1SM7Yk4jX3iLpRjFQtVBMD+tE0j6BxyQWlsPloQpUaEGMDDJc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m2KMc0fK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m2KMc0fK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DE7DC4CEEB; Mon, 2 Jun 2025 14:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748875598; bh=UIBVo/CWmB6ZkIMx+IJOkAf5JPwrhHWZWGk2m5ANiNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2KMc0fKJvNhvJtT4OTb+El9Itw6mwSTmSDlc3g3aRmQ95wHmjC5Qbml/EjCqaOTG 59i66ZBFpaUHYQnO0Dj/9R/YrN3MmcJ9gvPztAcVvOKNz7+3RAZ+GIP4QRxVlNOFzi sNoKy/HBH84PgObhCXcNZq2E8acJqBn6h22bBgu4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bibo Mao , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.10 184/270] MIPS: Use arch specific syscall name match function Date: Mon, 2 Jun 2025 15:47:49 +0200 Message-ID: <20250602134314.734435689@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134307.195171844@linuxfoundation.org> References: <20250602134307.195171844@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ 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 b463f2aa5a613..7acbe701afd69 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