From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B07EF346E44 for ; Thu, 26 Mar 2026 23:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774566217; cv=none; b=ovuo6JDt1HVS5vUFXfC2bRuSx0GE5aZXnZKgQSFnoKXQjoznFh8OgQPA9yUgWLVMvSiNHqw2uofQHcHfsQUY7n/wbOpGgjbWL+3isMP/B1EgGR2wMJlFDuNJK//UMwNdtsG8//Th0fJjJ3MwSXIq53xLiZR1EnVMiRpb/FUB370= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774566217; c=relaxed/simple; bh=5KAOHVpISA55mZm5NT+OHQLcTvIrs5mqEXRB3BduQwg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FwMOKXvK2kE/merJKqujJnoB6foVyGkm3J66RO2pheXg29F9KSPGTW56Se+ouxbQr2KY2LUi3kjXw4k2fEnPX8anmFby3mJDSR9KcC4Nqr5/u9UtyvYuJAUBD7uDno8gqOqhI7uMYSUw57FRD3TqUKxvk9hFrfNjtfmXF/+8yQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AcFZYPdD; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AcFZYPdD" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-48538c5956bso13948645e9.0 for ; Thu, 26 Mar 2026 16:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774566214; x=1775171014; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=R/TN6HvQ+xTPSDaAAvSPHxdODsPl8D/3Jbr6LOu1F6E=; b=AcFZYPdDYeIFAFEsIwpJoQhTgZtYHTwnInebF3m+S6mEx8er3RzU0TFeQ8kLSvxYYO MJ3sREjJQBKz0HTjBYm2gt1D4kWtIcSTqK5YBeHgW6LALwRwBGeVMn6ysdPNTdoA0MY3 9LuWTyNgh6TNCAReWwTfUW591w56fPQQJ4WLTsWhnIzokzOfthnnXUlOaHJ9GuLCtNF3 lykvNu7T9c7l2uAK2MmUcqpLgDEEE8Dvt+BusiJFPFVenfiyDMsZTJTUXCU/G1lwZqXY wIMexWIbfNTOmWn5FkQZ/9rKFkmRwOcbFSiSZddn+7Wss0JexGMdee7JUGumDn16hk0Q h61Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774566214; x=1775171014; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R/TN6HvQ+xTPSDaAAvSPHxdODsPl8D/3Jbr6LOu1F6E=; b=f25q69J0pPyM19sZKqtz0cFVqd+gLkuOhSJDNJx11jylhQSpzSrS9FqA2Ble1N6+S7 OLmYXiWDYgkMQ6HwLRJqNoxxww7/Vvjn7loUlbe9kvCglFHdm0zrxwihnOASHnutcijF e8Xk5RUF/45DNdFVFakeBMVovEAsCJ8nR11WojIb7mQBmAh6wAfyZ15+GgNX+/1dpyNM 0uPLme4nttkGV4aUgFT+S4qnpYjTi3TVwsW7M2BveHe8ETzy/R1nLq/JqtQWWYUXzaNu 2zYZ5KO7mB24IObi80cb5BTDEwK8K5Nmi5ijr0X2GvJUfWAv6qb7Wp82DMBCUOHtkkj9 iz4A== X-Forwarded-Encrypted: i=1; AJvYcCXIwmjttc8kDIdAdY+OScCLdRUVV7B9+Fv8JC26sMAxHwZsJrfk/xflx7nVlpEACcDkhQin4F/NE2ZGqdc=@vger.kernel.org X-Gm-Message-State: AOJu0YzF1qa1mKHAiqwlKUP0xN5+PhX6JjxxjmHeTRG/N7ftKqmwh7Hz +ZBogJFBOsxcnmNJpKEKO+AVRBKjST736Cn6+5K3R9j/TfPtKsyGfIqj X-Gm-Gg: ATEYQzzWlTYgreJvqxb+aRPC3z2SYS8uKX40G0MuBskaEPPg5anEav0zsnMgRBrN/c/ LPBm8WstmZR8PZ8EjUXstNxxs/InjjkvsIs88Nz8/DtJQ4SvOezSwFFfNFbOazFQ7gej2z/6DH2 Om+IG6Jzy25Ts6uYFfNIvGngl6JSuT+IAdg1q168+4oXw3bVCKD7F95i7oSPpKq7Bk5bepbzQ6M VQXnYVCoqdiRrvLxra0QZTRwDv+67NUYhTS5CCgt72FhIFaA+LSMgCxng9/Y+2L1mhds6j8JJw3 XjdSv0nsWeAMQQh0A4VEGwksilmE3fFdthFXR7qKWdH8Bx7RdDuzb7ifcyHRyZmUFrBww1kIsiC 1inpMR+uhoLsJM2cnrjlmZVT9jMjpQao8cvnQmHuLtny6IrnvHMu7aJ68y29cNSuw5IwsRCIye7 b65b4y5CUSIDYMUX7mh9oJDIc0cIyLH/S77uOKW5Mpx3CvnUaYjK0e7E+OXUrteV9oGFPd X-Received: by 2002:a05:600c:45cd:b0:486:fbc4:8fe2 with SMTP id 5b1f17b1804b1-4872912dd2bmr1429515e9.15.1774566213812; Thu, 26 Mar 2026 16:03:33 -0700 (PDT) Received: from osama ([2a02:908:1b6:8980:8cd6:6329:c43d:2fcb]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48727161bb2sm3519395e9.23.2026.03.26.16.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 16:03:32 -0700 (PDT) Date: Fri, 27 Mar 2026 00:03:30 +0100 From: Osama Abdelkader To: Will Deacon Cc: Catalin Marinas , Mark Rutland , Ard Biesheuvel , Breno Leitao , Ryo Takakura , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: panic if IRQ shadow call stack allocation fails Message-ID: References: <20260324161545.5441-1-osama.abdelkader@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 25, 2026 at 04:35:35PM +0000, Will Deacon wrote: > On Tue, Mar 24, 2026 at 05:15:41PM +0100, Osama Abdelkader wrote: > > diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c > > index 15dedb385b9e..b32ed7ef8e00 100644 > > --- a/arch/arm64/kernel/irq.c > > +++ b/arch/arm64/kernel/irq.c > > @@ -14,6 +14,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -32,23 +33,26 @@ DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); > > > > DEFINE_PER_CPU(unsigned long *, irq_stack_ptr); > > > > - > > DECLARE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); > > > > #ifdef CONFIG_SHADOW_CALL_STACK > > DEFINE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); > > #endif > > > > -static void init_irq_scs(void) > > +static void __init init_irq_scs(void) > > { > > int cpu; > > + void *s; > > > > if (!scs_is_enabled()) > > return; > > > > - for_each_possible_cpu(cpu) > > - per_cpu(irq_shadow_call_stack_ptr, cpu) = > > - scs_alloc(early_cpu_to_node(cpu)); > > + for_each_possible_cpu(cpu) { > > + s = scs_alloc(early_cpu_to_node(cpu)); > > + if (!s) > > + panic("irq: Failed to allocate shadow call stack\n"); > > + per_cpu(irq_shadow_call_stack_ptr, cpu) = s; > > + } > > I don't especially see the point in these panic() messages given that > presumably all sorts of other things will go wrong if we fail simple > allocations this early during boot. > > If you really want to check this, then we should at least do the same > for the IRQ stack itself, otherwise it's all a bit academic. So maybe > have init_irq_scs() and init_irq_stacks() return -ENOMEM so that > init_IRQ() can panic? > > Will Thanks for the review, I just did that in v2: [PATCH v2] arm64: panic from init_IRQ if IRQ handler stacks cannot be allocated Best regards, Osama