From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7D12E340DB8 for ; Wed, 24 Jun 2026 17:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782322480; cv=none; b=FDFqXIreX3E9RnfDQz4SKx3phEJaLmdFRJOse0Af/aF2CemjIYHSIzWHVsDmWQ237ulBwa/gSDzgKFt1i9inbp6MMm27TCmrghuyrrlf7hGoylHnwSGHIP/sliMT/zmtC/YT+zM6ZfL9e63kT/GyXAZYtpFo/3w8tTYf35UXdMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782322480; c=relaxed/simple; bh=pjqHv8bk/hT4O5x+fkl2+lKVa5uxxow/IbeFTdUG8+0=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=F/ST+TPPTMU78aKbUpI8TxR6l18Sj1iNVC8LYbM/iv4x4lyvAZ8QyE5m0h1KLabhIvuFzOAFK+XugWZg/Oal9zaroZAv4Tl6fT6zCTZfyxMVTjtNjwZ36cbxwofpunBNcxSZ/es/bKs40aN1+K1pVzE3i8u/pULvzibgGQLXljg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VvLtPgNj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VvLtPgNj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67E891F000E9; Wed, 24 Jun 2026 17:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782322479; bh=oA6wZjbHNuBs3YUsSuPciAzSckCSWyOtrSzRhAiMkj4=; h=From:To:Subject:In-Reply-To:References:Date; b=VvLtPgNjR72rxyp1YaL4PbTZu5mEarYNke2LP8vmzpc69QnB51kgOKRBboqTFdE4u HDWZVlhbRiBuIHNQOe80E+zfML/92LjHbAZMi6agyH+0d/AKq6r94zJ62P9G1WQDD/ /i7dVAp5OL3SrnnGAE2YvKRKemVm3tC80M+iUEWDcPY7Xq0GtD+YJ7Xlshd4+rKCBU LORScmwbjejcDxU+fADkdv03jDed2yb0yxxDWxEPyB4ewzM3/bKS0QPvXH8DGLMwaD O7UONfxvm4UnfE1YI12VY3z1GxoHX1pJL9mPJcLSNGbXX4DE8ZjkcEarWn0aTWGvSy etuIaZqXz1W9g== From: Thomas Gleixner To: Jinjie Ruan , catalin.marinas@arm.com, will@kernel.org, oleg@redhat.com, peterz@infradead.org, luto@kernel.org, kees@kernel.org, wad@chromium.org, ruanjinjie@huawei.com, mark.rutland@arm.com, yeoreum.yun@arm.com, linusw@kernel.org, kevin.brodsky@arm.com, ldv@strace.io, thuth@redhat.com, james.morse@arm.com, song@kernel.org, ada.coupriediaz@arm.com, anshuman.khandual@arm.com, broonie@kernel.org, ryan.roberts@arm.com, pengcan@kylinos.cn, liqiang01@kylinos.cn, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v15 01/11] entry: Fix potential syscall truncation in syscall_trace_enter() In-Reply-To: <20260511092103.1974980-2-ruanjinjie@huawei.com> References: <20260511092103.1974980-1-ruanjinjie@huawei.com> <20260511092103.1974980-2-ruanjinjie@huawei.com> Date: Wed, 24 Jun 2026 19:34:35 +0200 Message-ID: <874iirlu50.ffs@fw13> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, May 11 2026 at 17:20, Jinjie Ruan wrote: > In syscall_trace_enter(), the current logic returns "ret ? : syscall". > While __secure_computing() currently only returns 0 (allow) or -1 (kill), > this "ret ? : syscall" pattern is conceptually flawed. > > If __secure_computing() were to return a non-zero value that isn't -1, it > would unintentionally override the actual system call number. This logic > is redundant because if seccomp denies the syscall, the execution path > should already be handled by the caller based on the error return, rather > than conflating the return code with the syscall number. > > Fix it by explicitly returning the syscall number. This ensures > the syscall register remains untainted by the trace return values and > aligns with the expectation that seccomp-related interceptions are > handled via the -1 return status. > > Cc: Thomas Gleixner > Fixes: 142781e108b1 ("entry: Provide generic syscall entry functionality") What's fixed here? A potential future change of the __secure_computing() return value requires that _ALL_ callsites of that function have to be audited and fixed up, no? So the change is not a fix it's an optimization to get rid of the extra conditional. If you really want to sanitize this, then change the __secure_computing() return type to boolean (true = allow, false = fail) and fixup the two dozen or so call sites. Thanks, tglx