From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796270912; b=GmQDTEt758jj5D0FcpJ3Futs//WhWPozPeiuLlbZ214aYfZ15yjjFw1MMFa0dIX0T2q6 RJ7aEEuPHlsFMKxFbptIAlrQ6zd0ze+vuMXB1s0S8QIwB5mvD3hM3CiDqa469lUgYwImF nuynSjF8ONUU+I4rzqbX51TyRrWjIx3Xs6iztS7oohqliPtI3h66pS/ZuX7+mxW++67St 3R1euy9Xj1uU/yhqjoTcSd2n9MIPnJqFNc78PTQy6lcS8W4wkwOcPWDe2vRlO0QpJH5X1 wTfAcTw3h1RZV9X054UuMSHEyqdL9p4pQARxnZnufKf6kC0hOazAoqgNRLsdanfElSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796270912; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=N3+7ywSCV7Rc7dylu7aIoNnoZl9Ddl7YMsOL9aQ9h7o=; b=I7Zqt0hzQN2bemyoby0LKbN+PhkWZm9jRqA1/m7yJ7fB3UlcHf4SRWRv+coGPePA81jo RJ7LamKq+Eg0H4DVLPeW/LnAHKqCDLB3gdrS6Mvb/ebk5K3p3SjJQBk+X9wN/sTAV2oBg hs2o8JuHROaW7hnYiCIgoZu3hVGbKzDsCvFRpL6d5C3wU8HNXIssSaVuKi/D7HAUVSpHc 5h204xgLdXl2tUWEcmucH+pxQquK9veYvYJ0p0j9VMReH6TMn7AlqnVszXOVhfsTRKJNB KxXCHI+EvbeYXfTtthrjW74KJCKrAI5Vu4ga6yznp/wpebSJ8E0h7FTjEn12IueU8Gg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VBTLCALw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C458606A32D for ; Thu, 3 Dec 2026 04:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VBTLCALw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57FCC1F00896; Thu, 3 Dec 2026 04:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796270912; bh=N3+7ywSCV7Rc7dylu7aIoNnoZl9Ddl7YMsOL9aQ9h7o=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=VBTLCALwmm2qaa1SJ5bi4ukwwsg8dEP/IrpuuYQzjvWQdJgqhtuaiHpsSPkD+B1Ac V24pxjRPlKu/ao7LdYlhJ9kFtCCmO+cxFuW4P+RoXK68Aj+FtGCs1iObacgZjIfkNJ TNuC7bk+nfFp3R8epqHjjhxIrePs0YCze8AYuC9U3/qwcVvdFNBZBzyQC2sSiXCvfg 9uZ8bbDaTpimYhBbxRIUuW7muOTMZAlZ7vKxKAT2MbqqlyAEGiLffNVbTpFQgEsbj6 uESo2sxll6wE/DStGsDR/Qxy/M8/cplwlfSjrz7I6UvepPNZs4N3FZWUs1aIRc5tjq Fb8nrEJjkgwVg== Date: Wed, 2 Dec 2026 20:08:29 -0800 From: Josh Poimboeuf To: Zhao Gongyi Cc: peterz@infradead.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/unwind/orc: Read the CS slot without KASAN checking Message-ID: References: <20261203035454.7191-1-zhaogongyi@bytedance.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261203035454.7191-1-zhaogongyi@bytedance.com> On Thu, Dec 03, 2026 at 11:54:54AM +0800, Zhao Gongyi wrote: > The end-of-stack check in unwind_next_frame() calls user_mode(), leaving > the recovered CS read instrumented by KASAN. Commit e504e74cc3a2 > ("x86/unwind/orc: Disable KASAN checking in the ORC unwinder, part 2") > converted other recovered register reads to READ_ONCE_NOCHECK(), but > left this read unchanged. Best-effort unwinding can visit poisoned slots > within a valid stack range. > > Reading /proc//stack has reported a two-byte stack-out-of-bounds > read at this check: > > BUG: KASAN: stack-out-of-bounds in user_mode [inline] > unwind_next_frame > arch_stack_walk > stack_trace_save_tsk > proc_pid_stack > > Read the CS slot with READ_ONCE_NOCHECK() as well. Use the word-sized csx > member to satisfy the macro's size requirement, and test its low two bits > to preserve the x86-64 user_mode() predicate. The existing stack range > checks remain in place. > > Fixes: ee9f8fce9964 ("x86/unwind: Add the ORC unwinder") > Signed-off-by: Zhao Gongyi > Link: https://syzkaller.appspot.com/bug?extid=d081d4f4ee906c359975 Acked-by: Josh Poimboeuf -- Josh