From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9CEDD35AC07 for ; Fri, 19 Jun 2026 09:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781862693; cv=none; b=SZdzt0stZNcpFuYZW3pe80T384bA/s6ftoo8C+WsEbFW2dOjPKhkf/VjxOHZcx5ch4QmX7z39SSXjAahymN2DHUQSRGwOC10NnxyMh3/QiptqOrJz1zfZz3+uB5JdRK2yI3H2yj6YWRZRlX6yVzk0zWc3ETRWskGmWU/VcKAXDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781862693; c=relaxed/simple; bh=OroYXirJsDtmCVP7GQcrIX3ogoJcvh8eNLlqMpDtF2c=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=b39al0P6DFKTAH7Pw4K9FhbT4fD2YbAgMWI5Fp7d1A1Q4EAlXgvgCm8tq1neSswjuhM91H6sadkGewg3sYhJ0EWdy/7ZmdOl4PghpC1RpP/AnFAMCjLFVG/3Dm5b1xJX031POpLHILKJGBv1swLm2kNJ23CUzWfy6LT5Op/F33E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tilpw6Yo; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+wI9V3Mr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tilpw6Yo"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+wI9V3Mr" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1781862688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WZ1IagdnVV5TSo0RVKP9IMzKUX1buvpUmeHeQfapSPA=; b=tilpw6YoUZOSNHkMtcJp95Mc7b4AyNNFqqjoL0ggMK7knjoxriZ7ghkk5KPbC7FanKEWR5 faZKWOcXZA8ylgLDkx2wCNh6Ke0lkgN/ojq+qGwjGVRi6ADe+5IQkoas1IaRortZg6e/Tj +ejdFB0aTNhfXNqGGr+9GxAahX/KVt3l1FjxgBq6h0M/N3Bdd9/GlBma6pSYKPKhhru1+J 1jPCKH1gRApzE+L0hZBhqz5i9I3/5TPzK8lJoKXxzHDYCJrQu1/uwGHTtJ3HBptaP2Ixx5 h6Jj5F4L3i9oAwgi8Xr8qnmWdNZdQT4jAvB66tLNtoYAKjkggCfs+cEr7UKVUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1781862688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WZ1IagdnVV5TSo0RVKP9IMzKUX1buvpUmeHeQfapSPA=; b=+wI9V3MrwlaBhrA0/QNwdvQtkI9F1r4hmxAOk6jkUp2N+XlJcveUYnY/iGoQfVZZSb4RRw 4syuW7tr9cF1esBA== To: Jiakai Xu , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Chunyan Zhang , Jiakai Xu , Matthew Bystrin , Palmer Dabbelt , Paul Walmsley , Samuel Holland Subject: Re: [PATCH v2] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe() In-Reply-To: <20260517143704.659416-1-xujiakai2025@iscas.ac.cn> References: <20260517143704.659416-1-xujiakai2025@iscas.ac.cn> Date: Fri, 19 Jun 2026 11:51:28 +0200 Message-ID: <87zf0q504f.fsf@yellow.woof> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Jiakai Xu writes: > + if (!task) > + task = current; > + > + high = (unsigned long)task_pt_regs(task); I am concerned when CONFIG_IRQ_STACKS=y and we are on the irq stack, wouldn't this "high" be the wrong one? I haven't validated it, we probably need something like if (on_thread_stack()) { if (!task) task = current; high = (unsigned long)task_pt_regs(task); } else { high = per_cpu(irq_stack_ptr, smp_processor_id()) + IRQ_STACK_SIZE/sizeof(ulong); } Nam