Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1718936rbb; Mon, 26 Feb 2024 21:14:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYMaRI6ak1c+prMC22jiMv1J0g8wn1GVLJJBnl5Sbyvj1RVKgH3G0voVjST6uVkT4vMP6Kz0khT7PYyzSaWls0S7PANpR5Q9oVOn4LkA== X-Google-Smtp-Source: AGHT+IEei3B0r++qtj7LUWlmPRM3hKyV5kagyJ/cg76yXtUTqxRdoMjNSJslfGT1PMikFr5Xzx5l X-Received: by 2002:a17:906:f55:b0:a3b:eaa3:ecc4 with SMTP id h21-20020a1709060f5500b00a3beaa3ecc4mr5942556ejj.60.1709010896847; Mon, 26 Feb 2024 21:14:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709010896; cv=pass; d=google.com; s=arc-20160816; b=H3Kf6MMAlOgyz6FwP7T/2xvBpKwcNWcn1rJNmbmS66DSAFJczbvJHJnxTfPj6oKveV vUeqEiV0h8B/EEHJF5hTooqJn5cZydEUoHLCNoXZFPyAstlPRx/iEmJQnUF5/qm4sqra FMoCDszuDAppGVQ3DpY28qbog+g00uK7zOeoVd2yK3h2BPobB0ujw04K8X41YUgMi9O1 rKVweItQ9DFjjapWMyUmbKoYybBuNEgBQqyYvXaaOD684HojORPnD5NJ4eugISSbFw8G R7DvtynqWOc+GXo1WlcE4z+4ujKa+75kmc9s0fZzHsORNpymKMkLidXmAQrND2yEUvrE bFHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sWFuBwl27iNZ77C5NLrZ6Az36CpXkU02/TUufhG8bE0=; fh=3ynnNE0lEkjBsJ5xbg51H0hQnqZ5DhcMGpaBecNZL6M=; b=mYP61SSwAhujqY81r9v7AQQag/feLqdwn4kO6xZbWpjgWLxSAVFyRWatlOWmZJNmzO p/ifX/YJeWAkMfgO8UvGe0zI+hcSjD2nVJ2YGzB7/xUmedJQginciq6Tagf/M4UfHA3F pO2ELe+2OboK2ejF3LIRMkhDIBoWLXVK66yzl2zJbG1PSIW752GrReFr0dd5awLNc9he 9LGxGfpXzLJ/I26cSwwbyBYr4/bY/7RDLI4suzBNIZvPIe/QEvD8Lir/4Bc1ZfLRB8vJ UFGVrVMmZAtxydG8rVUymCs/wvp17mMUbgncgZ3EiyTIA82JniHHzh/UxaQ73oUqY480 cGQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v5RPXDlA; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-82716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i14-20020a170906114e00b00a43ab10e7c4si273428eja.824.2024.02.26.21.14.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 21:14:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v5RPXDlA; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-82716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 996371F250BE for ; Tue, 27 Feb 2024 05:14:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B943852F7E; Tue, 27 Feb 2024 05:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="v5RPXDlA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 999D0524BB for ; Tue, 27 Feb 2024 05:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709010888; cv=none; b=hGXGuCjnTuJNjpkweilw5DA9Wu69tt4ND6j0uNcFiwvSYkg/VwuYqzeQhaSceKu+MMaRKvBCSS7OmfIhI24l7Db6EzSEOinuBgAsM1dmsvNVSR1tuo2nRDCKj6S2KdtIGAhU+NUEQPgLVnhDhFUoontUhO4f/gHY5DJW4VfHf24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709010888; c=relaxed/simple; bh=9ug22FuSGdCqHLfKK1jLGa5UY1EagxrgLC31lpxI5NQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rmXrA79guj7XpN/XTGyueNBiXOWJ0N8p+u/90LE/F1SlIiIvZ+SSNttEC/Eo9TRUdKVQHqNlFVdMYF07pPqGa1yIJU5Emg2TMKo4yfY0p6q3DigA+Q6uyd6keO+/WNNnlUtK1+lTv1kdZxra5gNsvBMk80anWk+gkBeRZ94i9hc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=v5RPXDlA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DACBAC433F1; Tue, 27 Feb 2024 05:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709010888; bh=9ug22FuSGdCqHLfKK1jLGa5UY1EagxrgLC31lpxI5NQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v5RPXDlA3GFP4rtthRPk4+rLOyzBtsjWMB2wPps8K0Q8tqv3lGT1dQJFus5qfaskX jT6Z0PmcDiVG1phTZs+bAR2pKITf5ZiY5FB8KfUosglsH7sth8djTs5K4IZc5p3f2p il2INF3XKh0pGC5LMRHdGnKz9tfS8UaxKnTNbydQ= Date: Tue, 27 Feb 2024 06:14:45 +0100 From: Greg Kroah-Hartman To: Michal Hocko Cc: cve@kernel.org, linux-kernel@vger.kernel.org Subject: Re: CVE-2023-52451: powerpc/pseries/memhp: Fix access beyond end of drmem array Message-ID: <2024022750-treble-wish-b009@gregkh> References: <2024022257-CVE-2023-52451-7bdb@gregkh> <2024022639-wronged-grafted-6777@gregkh> <2024022652-defective-fretful-3d13@gregkh> 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 Mon, Feb 26, 2024 at 05:36:57PM +0100, Michal Hocko wrote: > On Mon 26-02-24 17:12:19, Greg KH wrote: > > On Mon, Feb 26, 2024 at 04:25:09PM +0100, Michal Hocko wrote: > > > On Mon 26-02-24 16:06:51, Greg KH wrote: > > > > On Mon, Feb 26, 2024 at 03:52:11PM +0100, Michal Hocko wrote: > > > > > On Thu 22-02-24 17:21:58, Greg KH wrote: > > > > > > Description > > > > > > =========== > > > > > > > > > > > > In the Linux kernel, the following vulnerability has been resolved: > > > > > > > > > > > > powerpc/pseries/memhp: Fix access beyond end of drmem array > > > > > > > > > > > > dlpar_memory_remove_by_index() may access beyond the bounds of the > > > > > > drmem lmb array when the LMB lookup fails to match an entry with the > > > > > > given DRC index. When the search fails, the cursor is left pointing to > > > > > > &drmem_info->lmbs[drmem_info->n_lmbs], which is one element past the > > > > > > last valid entry in the array. The debug message at the end of the > > > > > > function then dereferences this pointer: > > > > > > > > > > > > pr_debug("Failed to hot-remove memory at %llx\n", > > > > > > lmb->base_addr); > > > > > > > > > > While this is a reasonable fix and the stable material it is really > > > > > unclear to me why it has gained a CVE. Memory hotplug is a privileged > > > > > operation. Could you clarify please? > > > > > > > > As you know, history has shown us that accessing out of your allocated > > > > memory can cause problems, and we can not assume use-cases, as we don't > > > > know how everyone uses our codebase, so marking places where we fix > > > > out-of-bound memory accesses is resolving a weakness in the codebase, > > > > hence a CVE assignment. > > > > > > Does that mean that any potentially incorrect input provided by an admin is > > > considered CVE now? I guess we would need to ban interfaces like > > > /dev/mem and many others. > > > > If you have your system set up to prevent admins from accessing /dev/mem > > (isn't there a config option for that), and you can access it, then yes, > > that would be a CVE-worthy issue. > > > > But if you configure your system to allow an admin access to /dev/mem > > then you wanted that :) > > OK, I thought we are having a serious discussion here. Now I am not > really sure about that. I am serious, sorry if that came across as not. > > > > If your systems are not vulnerable to this specific issue, wonderful, no > > > > need to take it, but why wouldn't you want to take a fix that resolves a > > > > known weakness? > > > > > > I have explicitly said, the fix is reasonable. I just do not see a point > > > to mark it as CVE. I fail to see any thread model where this would > > > matter as it would require untrusted privileged actor to trigger it > > > AFAICS. I am happy to be proven wrong here. > > > > We can not determine threat models when filing CVEs as we do not know > > what your threat model is. All we can do is determine if this resolves > > a weakness in the system. A use-after-free is a weakness and this > > resolves that issue. > > Sure, you cannot make any assumptions and nobody questions that. We do > have a certain common sense though. And if somebody comes up with a > usecase that we haven't anticipated then we can surely assign a CVE. > I though that level of control is exactly the reason to own the process > by the community. > > All that being said I dispute the issue fixed here has any more security > relevance than allowing untrusted user to control memory hotplug which > could easily result in DoS of the system. Ok, I traced this call back, and here is the callpath, starting with a write to the the 'dlpar' sysfs file (conviently NOT documented in Documentation/ABI, and it looks like it violates the "one value per file" rule...) dlpar_store() handle_dlpar_errorlog() dlpar_memory() dlpar_memory_remove_by_index() Yes, the kernel by default sets 'dlpar' to 0644, BUT that means that root in a container can cause this use-after-free to happen, or if the permissions are changed by userspace, or if you are in "lockdown mode", or if you want to attempt the crazy "confidential computing" model, or if you have a system which root is possible for some things by normal users (there are lots of different security models out there...) Yes, I will argue that making the sysfs file writable by userspace is out of our control, but what is in our control is the fact that there is a out-of-bounds write that is fixed here, and we don't want those to be able to be triggered by anyone as that is a weakness in our codebase. That is what has caused the CVE to be created here, not the fact that root can remove memory as that's the normal expected operation to have happen here. However if the maintainer of the code here disputes this, we are more than willing to mark this invalid and reject the CVE. thanks, greg k-h