From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (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 C0499239E6C for ; Mon, 13 Jul 2026 06:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783925970; cv=none; b=khEbx6x2y1z+/hPaz93vUzQB1hHHzL0tlRFjf5fWqjYQiYHhk6rQ3q7m1hOINsRL4BwCu7DkwhOxv7cekfbPX7025Lk7vwyC0Gc431qSNH9jQ8DqaiPV/QI/wPofsbCRC7k6o3YH6+vjkQowxlnqIB9RfaOPbQjv6oEQ2yh2UQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783925970; c=relaxed/simple; bh=JsFteFKHkncfn8SdODrOFUe38sky9ingrl3PxIbv2QQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=BsBJX+UL2ONOG6e5FCyqnmMbK3h4+VTSSoewxo98LaoROX+4VDeQ8rkVooobPpAc4s+v7f/8LU97CHK4w1m1cx6qbQRNBR4PL/lT5qSWj14FLbInzeIa+5EpT62t4N/fYNanIJwfgIy0PR65upfMV2wZy9O4ATZiq2EFEk8KaP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=Hi1kKSAS; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="Hi1kKSAS" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=qCKtYd0KrS9iA86oHouqdvS8drpMdPPxhpD82omBp/Y=; b=Hi1kKSASpycUH88nITCS9wSaQRX1V1nz7GEv9lLxeTiqYGCEAWyVINkgRk6o9kWO2MRNZL28U CYWceHDL93Ln97no6OtGvv/+xJmBAQST/9U09we2NtCk481lUxCzXlA/8jjSgGY6Vie6jCajINQ wLM7I+fKhPrE0F8X8RdoCOI= Received: from mail.maildlp.com (unknown [172.19.163.200]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4gzCjp0RhGzLlTK; Mon, 13 Jul 2026 14:50:06 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 1FECC40563; Mon, 13 Jul 2026 14:59:23 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 13 Jul 2026 14:59:21 +0800 Message-ID: <86f4c6b1-d7e1-4f65-a566-d00ea3766f4e@huawei.com> Date: Mon, 13 Jul 2026 14:59:19 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fix: arm64: syscall: use live x0 for syscall_get_arguments() arg0 To: Yiqi Sun , , CC: , , References: <20260529065444.1336608-1-sunyiqixm@gmail.com> From: Jinjie Ruan In-Reply-To: <20260529065444.1336608-1-sunyiqixm@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) On 5/29/2026 2:54 PM, Yiqi Sun wrote: > On arm64, seccomp obtains syscall arguments via syscall_get_arguments(), > where arg0 is currently read from regs->orig_x0. However, the syscall > wrapper consumes live arguments from regs->regs[0..5]. > > A ptracer can modify x0 on syscall-enter stop before seccomp runs, > but cannot update orig_x0 through that interface. This can > leave seccomp checking stale arg0 while the syscall executes with updated > live x0, allowing seccomp bypass when filters depend on arg0. It seems that there is indeed a problem. The modification by ptrace is inconsistent with that checked by seccomp. Similar with following another problem. https://lore.kernel.org/all/20260713025712.416366-1-ruanjinjie@huawei.com/ > > Make syscall_get_arguments() read arg0 from regs->regs[0], matching the > actual dispatch arguments and removing this desynchronization. > > Fixes: f27bb139c387 ("arm64: Miscellaneous library functions") > Signed-off-by: Yiqi Sun > --- > arch/arm64/include/asm/syscall.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h > index 5e4c7fc44f73..4bdb4d3ce2b4 100644 > --- a/arch/arm64/include/asm/syscall.h > +++ b/arch/arm64/include/asm/syscall.h > @@ -81,7 +81,7 @@ static inline void syscall_get_arguments(struct task_struct *task, > struct pt_regs *regs, > unsigned long *args) > { > - args[0] = regs->orig_x0; > + args[0] = regs->regs[0]; > args[1] = regs->regs[1]; > args[2] = regs->regs[2]; > args[3] = regs->regs[3];