From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C66DAD3000C for ; Fri, 18 Oct 2024 13:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/4m+8zC8kST9VqAtvnY7cJoijczDcv+CbcDDPUlmOaU=; b=Zuc2CMNkVb7ijV NF3T/6HGpIKVdVlrxlV2sTlJeKejIvUyZX68aTWrfRr/TaPyzZYAfhYA0XE6lm4ZkC4V8AK9Dl7Nn h6YnW0wve2vtGR4brzxfsHIl7wQU2cJaxZ700CQhnVmcjldqmKCuEpPJzG3cEuyFCD59j1Lyx5Dak Utz8zS0edd7GU4yG8fvLfpFXhFxuzdOG06HfKYuK2D2laHxX/BtYxgRSBjcVMXneTZnreQhJrkRi6 TVg7yvzZYT2GHcQaB/MW9BCw6R5W2NA49VMtFHGzFDMNyPLKu7e1tq9uJA69v6eSlL0peVFdm3rCP iSTz2zivoRPb5khT/NfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1nM2-00000000xE9-3AVZ; Fri, 18 Oct 2024 13:49:22 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1nBf-00000000uWb-2yUe for kexec@lists.infradead.org; Fri, 18 Oct 2024 13:38:41 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-71815313303so869019a34.1 for ; Fri, 18 Oct 2024 06:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1729258718; x=1729863518; darn=lists.infradead.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=nVQC71FpKRWshBPwUAPRSfOi9KhTjaLXAKPeTx4sMCY=; b=aXkiSH6zamgFvFfEXPI7Arm3sxOdfVV56rTuiCKjVvwYNPUmO6ReS+o6+bcIEoW9KD vlNs7unyBgJLAJPQzKCIVOyGqQymG2BwKHDD2IQ3JWp5PLJm0uJeT6NCO0yDRqk2rPFQ OwpzC9KBqEbzBm6acpl03SrdYEqdw8Q+gPiv3JR87BKmxBHJ8clQEoEBpyLybjbYliZ1 Jr+toh/I+vGyagmeNx2LM2QjJmQAYNPFnjg4N8RbTdJViIpbRVtelgk3UdhLoxRAiKoE 6q80leuv37Ds/VLN69xPyJL9CXxKTLGexNDl03DPdHYMnj5YRe7AV/tmJX4ON6nrtmyb AAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258718; x=1729863518; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nVQC71FpKRWshBPwUAPRSfOi9KhTjaLXAKPeTx4sMCY=; b=LEm1yFz/k+ipGOCQ0uZ9pMchcczBILD8siuSpmH4MSkgkBVwgivPHBucU8T9gI1pli vgNV81bRF/lpX0+hMYKMmi3CZUWVPBv20gA6GdBoNk8WC13cY0IFzv6htwtsTT1b9e30 Kgg8Sc3Os3fcpXbarpU71+1G4Hym+GUq7DPF6TzM8XbbEz6IF9wTmtUskDbthbnA6QHW bD22PTEcxAtAUQxQBXEOCiWw32k99IJDXU9QKmi7h+Tw4QR0WhnSrixIieSR9yBxDEk6 m9oBRT0HQm/4wHwzpj3N7jjizqsHmks7k3oPhvDCMOEH4Zsl1Wsg+jZhk2n5ADDxGQLt y1rw== X-Gm-Message-State: AOJu0YwBVmL5XiCJiZ4jt+ir/9xzn03QsIlNmCGwd7Rwtj2zYc8A1e8J 7iy3F1WqTZGGhAWQad1eaHbxxoCy0Irp2q0HZ47lLOOJy8Yg+lAfUilkiheZKJo= X-Google-Smtp-Source: AGHT+IHhM/hhdws8NWJZR7xLe9RfCiROWNQkWuLLhXb3EaaMsAeiBTYEXM+95+rEIX3njEZZmQYboA== X-Received: by 2002:a05:6830:6f49:b0:718:a52:e1c7 with SMTP id 46e09a7af769-7181a81d73fmr1358859a34.17.1729258718312; Fri, 18 Oct 2024 06:38:38 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cde122b017sm6974436d6.78.2024.10.18.06.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:38:37 -0700 (PDT) Date: Fri, 18 Oct 2024 09:38:37 -0400 From: Gregory Price To: Andy Shevchenko Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, bhelgaas@google.com, ilpo.jarvinen@linux.intel.com, mika.westerberg@linux.intel.com, ying.huang@intel.com, bhe@redhat.com, tglx@linutronix.de, takahiro.akashi@linaro.org, stable@vger.kernel.org Subject: Re: [PATCH] resource,kexec: walk_system_ram_res_rev must retain resource flags Message-ID: References: <20241017190347.5578-1-gourry@gourry.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_063839_925671_E7AA1397 X-CRM114-Status: GOOD ( 17.47 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On Fri, Oct 18, 2024 at 03:57:30PM +0300, Andy Shevchenko wrote: > On Thu, Oct 17, 2024 at 03:03:47PM -0400, Gregory Price wrote: > > walk_system_ram_res_rev() erroneously discards resource flags when > > passing the information to the callback. > > > > This causes systems with IORESOURCE_SYSRAM_DRIVER_MANAGED memory to > > have these resources selected during kexec to store kexec buffers > > if that memory happens to be at placed above normal system ram. > > > > This leads to undefined behavior after reboot. If the kexec buffer > > is never touched, nothing happens. If the kexec buffer is touched, > > it could lead to a crash (like below) or undefined behavior. > > > > Tested on a system with CXL memory expanders with driver managed > > memory, TPM enabled, and CONFIG_IMA_KEXEC=y. Adding printk's > > showed the flags were being discarded and as a result the check > > for IORESOURCE_SYSRAM_DRIVER_MANAGED passes. > > > > find_next_iomem_res: name(System RAM (kmem)) > > start(10000000000) > > end(1034fffffff) > > flags(83000200) > > > > locate_mem_hole_top_down: start(10000000000) end(1034fffffff) flags(0) > > > > [.] BUG: unable to handle page fault for address: ffff89834ffff000 > > Please, cut this down to only important ~3-5 lines as suggested in > the Submitting Patches documentation. > > Yeah, I see that Andrew applied it to hist testing branch, if it's not going to > be updated there, consider above as a hint for the future contributions with > backtraces. > noted, thank you! > -- > With Best Regards, > Andy Shevchenko > > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 4F0E1200C92 for ; Fri, 18 Oct 2024 13:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258721; cv=none; b=Z5ms3N0QYYyPSNy+5in6t+kTEca/1F/gPyH6qgz3tu5SswZTvCp4NydcY+X4eW9Oh5YmX1tWokeycNhprX20pJaam0te2/yjbErwQqE2Ob73G/fSrDPr66PwbDJJfumzKG85MdensNIBxFsuQssXVzGj5KXnH7bHvpZ7X58Z2E0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258721; c=relaxed/simple; bh=0PH9ZNuHVfDm1Ir0FY5lORCCqHB0yu/JEIaTFjCE54Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QFXkjq5aSJSbUX8iV1/004UnXdMWZFpr4sJyCoj+53iCiDE58WG0ES/jGVHmRrYVzA3ycfFnUnPoamO7+VE7uyliYzzsc8OZ8z+WPo6lA5s4FUof4g+BG5fHx5s9RBt5hXnicwmyb9bcS4LxwA9CSwV2QgwLGOU/OBSvrQi9FH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=ggrTegPA; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="ggrTegPA" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-7181a8af549so348244a34.2 for ; Fri, 18 Oct 2024 06:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1729258718; x=1729863518; 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=nVQC71FpKRWshBPwUAPRSfOi9KhTjaLXAKPeTx4sMCY=; b=ggrTegPAkbe6a2KzhqnrCK/9V0goCfbsmIKkAaMo+LLjk2SlvCyDNn7CN/uGYxhBW4 fOUZCmj3h5Ny/UwXtlNsnhguzBLkcGisIVGmx7VAWhKfEWXu9n1ic92vW7A0Xl2Mb39s 2pdU4DmH7ycbzfqrDEEuE0XNDXkgyZUXk6GOtZxZBp73YSXU5uzfZ3zSdflY6Q9vNdQ9 +BE0qEINVqyEZ9hqfqSSfFohtgmztIOnX4rOtfjgDBfdVnU/MHW0Wg2TCB+Cao1PTi/K NziZCV3KGmHhVo543q4L1+yXfmrz2YxI9EgOpNP3k0/OJEZB3ackkh2r3ld5Io7YUuSM OQJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258718; x=1729863518; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nVQC71FpKRWshBPwUAPRSfOi9KhTjaLXAKPeTx4sMCY=; b=Tf6siTXRIUyflbGS6A8pqyeA1QkQXqlmI2bU1HIFY3oQrzNd09RmranuIcKd+fRW4h FyBla7u/iBLWLMh+/qeXSq49Dsa7p/3d5QlUfYV45bJ8Wdv1xBTBoHCoq1I51VFgbYD4 PKi5Dg5lEp35X2fMr183w7iPdihK7728LxBEWaqF06FLPJwom2ye3cNTjp2itH2mknwJ 3BklD45L1uERVFOIol4EyaOOXTMdtangVwRKOuKHqW15J+mRHe1f2vNOUCi3Nurfsvdq u0ewHTsdPOw4T2aOh+N/E0xSEmRCAZdvW+3a3dEXxSFm93gDpk0RPoeG+CLiqhb0IXUF jB5g== X-Forwarded-Encrypted: i=1; AJvYcCU/27YtfPufB0zFf9UH/ro7Xj6VV2Ac4g/flgc1C4kdz3W+VRBWVJdTw/JLatfDR6bSPHWpa9E=@vger.kernel.org X-Gm-Message-State: AOJu0YyKIigxTD1ZmHze74MkzP3LiEV9MBPH8s7EuSbBx09DPo89QgrU Rr1Qjq3qAOpmjMk3uQnWkjwLb6hLrtni5zTyAgr29MvcBl7lkkt71amTUNJi95s= X-Google-Smtp-Source: AGHT+IHhM/hhdws8NWJZR7xLe9RfCiROWNQkWuLLhXb3EaaMsAeiBTYEXM+95+rEIX3njEZZmQYboA== X-Received: by 2002:a05:6830:6f49:b0:718:a52:e1c7 with SMTP id 46e09a7af769-7181a81d73fmr1358859a34.17.1729258718312; Fri, 18 Oct 2024 06:38:38 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cde122b017sm6974436d6.78.2024.10.18.06.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:38:37 -0700 (PDT) Date: Fri, 18 Oct 2024 09:38:37 -0400 From: Gregory Price To: Andy Shevchenko Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, bhelgaas@google.com, ilpo.jarvinen@linux.intel.com, mika.westerberg@linux.intel.com, ying.huang@intel.com, bhe@redhat.com, tglx@linutronix.de, takahiro.akashi@linaro.org, stable@vger.kernel.org Subject: Re: [PATCH] resource,kexec: walk_system_ram_res_rev must retain resource flags Message-ID: References: <20241017190347.5578-1-gourry@gourry.net> Precedence: bulk X-Mailing-List: stable@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 Fri, Oct 18, 2024 at 03:57:30PM +0300, Andy Shevchenko wrote: > On Thu, Oct 17, 2024 at 03:03:47PM -0400, Gregory Price wrote: > > walk_system_ram_res_rev() erroneously discards resource flags when > > passing the information to the callback. > > > > This causes systems with IORESOURCE_SYSRAM_DRIVER_MANAGED memory to > > have these resources selected during kexec to store kexec buffers > > if that memory happens to be at placed above normal system ram. > > > > This leads to undefined behavior after reboot. If the kexec buffer > > is never touched, nothing happens. If the kexec buffer is touched, > > it could lead to a crash (like below) or undefined behavior. > > > > Tested on a system with CXL memory expanders with driver managed > > memory, TPM enabled, and CONFIG_IMA_KEXEC=y. Adding printk's > > showed the flags were being discarded and as a result the check > > for IORESOURCE_SYSRAM_DRIVER_MANAGED passes. > > > > find_next_iomem_res: name(System RAM (kmem)) > > start(10000000000) > > end(1034fffffff) > > flags(83000200) > > > > locate_mem_hole_top_down: start(10000000000) end(1034fffffff) flags(0) > > > > [.] BUG: unable to handle page fault for address: ffff89834ffff000 > > Please, cut this down to only important ~3-5 lines as suggested in > the Submitting Patches documentation. > > Yeah, I see that Andrew applied it to hist testing branch, if it's not going to > be updated there, consider above as a hint for the future contributions with > backtraces. > noted, thank you! > -- > With Best Regards, > Andy Shevchenko > >