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 4DACA36404E for ; Mon, 27 Apr 2026 16:37: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=1777307851; cv=none; b=c51zPqgzsxhgIWdZmChccLQbXOClcrHDPVUiBvFsOJl55uPPDx5J5/zDMLfokeEFDmYhhwODh9n31V7EJ3LU1iMtOsED2dx4+Omz3iOLJuIfxfMPfHCDxNVIFB4i6xTJLQ54YtuzcpQ0SKyglRUk05o744pcxLRVLDVWFh26RYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777307851; c=relaxed/simple; bh=c4w/gn+RFWvVPTAD3MQSYmD5ZBQuoJtv9iUyG9pCffs=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=egeVITc1BaW0zSIslnMhW7qj7pKNNss6sRtClwanLV0+QF6d+hkmJCdAMoOTAjh5nlxHZDK17+kWgjo2PBAxyWmMdw1NiIdoQduclc2jCh4Kh720/GkhDxHc4GkHO9R4F1PKGeCJcrFYeeNTEjZbN0hZVEXD/wG+8PaT6uWPRMM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tXUZ7K7n; 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="tXUZ7K7n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0792C19425; Mon, 27 Apr 2026 16:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777307850; bh=c4w/gn+RFWvVPTAD3MQSYmD5ZBQuoJtv9iUyG9pCffs=; h=Subject:To:Cc:From:Date:From; b=tXUZ7K7n3ljGAK6+qj2GiDrDS1QxIRGZOn7KIw1rxLpRRjPte8LkpNSpAVzuhshZf b96FfPKlH9sIyS5EwAFwoOfv5sq8NF4GaIpR2hfMB0gPqfI7uxtu7MvxhIwz9fW7Cm 3+MI2Dp+EyPLIqmE2o6ehHNT71aIp+a4laF5Bucg= Subject: FAILED: patch "[PATCH] LoongArch: Add spectre boundry for syscall dispatch table" failed to apply to 5.15-stable tree To: gregkh@linuxfoundation.org,chenhuacai@loongson.cn Cc: From: Date: Mon, 27 Apr 2026 10:36:49 -0600 Message-ID: <2026042749-impromptu-yeast-b4ca@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 5.15-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-5.15.y git checkout FETCH_HEAD git cherry-pick -x 0c965d2784fbbd7f8e3b96d875c9cfdf7c00da3d # git commit -s git send-email --to '' --in-reply-to '2026042749-impromptu-yeast-b4ca@gregkh' --subject-prefix 'PATCH 5.15.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]); }