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 913C536404E for ; Mon, 27 Apr 2026 16:37:25 +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=1777307845; cv=none; b=db4w4rvHmCy/mVx4WDDlTi3AwMN2TBv7VJo1/ZfSedz2EZALIPdSpZ1pLqazIhPQWO0imTHZzb0T3cAmrVXC7FYEuLRfLFk3NJ8I7ZHMuYASpZM5PRAv2MA1JBNngR34J90ykjp/NCqxxDgpbR9TtIv9faqSDM0WwkBAXQI3vv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777307845; c=relaxed/simple; bh=QjWuB72N8x43g9PKl+HznBcWZug0qdbH2tcA/9S1Qds=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=crd/7ovepDWsxEPL2JFZ0hKmWvM3OrjLcIhPMaCMHjOkOoqJ4b3RfCThGudcWaBeSxybX+B8pAftp775A4gD3u+Yltm4tMUvuwF4WZ7NTi1Xl0rQEkaWf6B42rYuQ6RqXfXWN0kxqxS7/YV5ueESKkUdCPziN76/Nx/p5QatqLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jndIsUts; 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="jndIsUts" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2D1BC19425; Mon, 27 Apr 2026 16:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777307845; bh=QjWuB72N8x43g9PKl+HznBcWZug0qdbH2tcA/9S1Qds=; h=Subject:To:Cc:From:Date:From; b=jndIsUtsVtN/E9+MkSFeDxZRn03BGaGNLKJI3C9Cqsc5ZOD7FXmENesLgIEuc2L7W C7fKYaHswd131c5q0QsIKmY42F+RZbjHY8dn0emiQrwv/5joQlhOp6mstueXLF/Sss mKWuy3AlzA4wPo6ooKaQIIsqpwC0WL3WTDPe7Ic8= Subject: FAILED: patch "[PATCH] LoongArch: Add spectre boundry for syscall dispatch table" failed to apply to 6.6-stable tree To: gregkh@linuxfoundation.org,chenhuacai@loongson.cn Cc: From: Date: Mon, 27 Apr 2026 10:36:48 -0600 Message-ID: <2026042748-removal-hesitate-2626@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 0c965d2784fbbd7f8e3b96d875c9cfdf7c00da3d # git commit -s git send-email --to '' --in-reply-to '2026042748-removal-hesitate-2626@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 0c965d2784fbbd7f8e3b96d875c9cfdf7c00da3d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 22 Apr 2026 15:45:12 +0800 Subject: [PATCH] LoongArch: Add spectre boundry for syscall dispatch table The LoongArch syscall number is directly controlled by userspace, but does not have a array_index_nospec() boundry to prevent access past the syscall function pointer tables. Cc: stable@vger.kernel.org Assisted-by: gkh_clanker_2000 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Huacai Chen diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/syscall.c index 1249d82c1cd0..dac435c32743 100644 --- a/arch/loongarch/kernel/syscall.c +++ b/arch/loongarch/kernel/syscall.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -74,7 +75,7 @@ void noinstr __no_stack_protector do_syscall(struct pt_regs *regs) add_random_kstack_offset(); if (nr < NR_syscalls) { - syscall_fn = sys_call_table[nr]; + syscall_fn = sys_call_table[array_index_nospec(nr, NR_syscalls)]; regs->regs[4] = syscall_fn(regs->orig_a0, regs->regs[5], regs->regs[6], regs->regs[7], regs->regs[8], regs->regs[9]); }