Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp747392lqs; Fri, 14 Jun 2024 04:49:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxuYaWnV26JbgZskTt4M9t+9opaMAAMufoJyDjuqauyChffxxg0hiHuu6Dhb4x+VtLeu2Y3zEvM4mN78UQpmlXe/fzE9a0KFdxbOEfag== X-Google-Smtp-Source: AGHT+IF1r5ZyPiWUDyvQZgS2U05bWFyfdfSyDfGe6gA9cAr8R2KfJtTFCEgwx2o2WUwlAt02DLgy X-Received: by 2002:a05:6a21:18f:b0:1b8:27dc:10c7 with SMTP id adf61e73a8af0-1b8befd97cbmr9014223637.12.1718365764039; Fri, 14 Jun 2024 04:49:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718365764; cv=pass; d=google.com; s=arc-20160816; b=TI9xjyOjgZbIb1Nh430kB4vZX8Sv+dBwAW1HihBmTAp6tN5Vh9dxrOmhV29r5dxKCr 9iHURqKdxhu8cBAObgxd4CPTxCDV2wYahC0EIv00VF/2c874Ja9ZAchyZ4BV/Ul9WIkY bf3ITRPhyGbJFbW4iDnNyiJDdBdZ6EoaO0fnUGwcrf8vnl9sjYb7PbBpze7cq4pgz8fs xhwp+CHMZpHPqP8iPShQG/Clb7daAfXuFETTDtdpKalbKg+XS41jI0qmKa2LeXmzQU1P MeKWyDp02xEInV/0gky3g/jHUTn8fkqqnGlPTIYJkoE7vOysqLNxsDGYrl7L6ix25/PU jLSg== 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:dkim-signature:dkim-signature :dkim-signature; bh=7CrLYCz09vrQoCSmw+MIDjSXKU5jzuAlXQ7QADNdyiY=; fh=kAXVhYOitrxUrSdpv5oXmKKoHwPID9t6YUO7Ggr/Odg=; b=b9ybmqJzH7qNBA1XzYIaV54wlZF6KHb9Q5uJxqgbeFVQcjUQvdxK9qJb5bL9nQcoy+ oBTYudsnfiJEMVCX1U6EhGfD6HLmtqoG9IIXgSb0HImIsfu5GAjuJbZKpe9qW0XwHj36 oD9JUX70eOo8/7vJI9Yn0Jz+fJUXvqkLvggPww39GIoZlOUR+ZmZ8zrdvz4ulmRQslgG BgnVxsjEwATqS+68Nb70Ww1HYxOtrKpFYuSTXPtH7Xdn8PoWCdAiTvsLIjHU8HYS6hSj phRotEs2k5AE8jUcJjIn1QMRjavmsSbzmZHaY8RzoBkXjFEvy6m2Cl3SaeoBCitpcVEb cqjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=E2cu7y74; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=E2cu7y74; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-214848-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee67b8590si1039974a12.824.2024.06.14.04.49.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 04:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214848-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=E2cu7y74; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=E2cu7y74; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-214848-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B41AC28A9E3 for ; Fri, 14 Jun 2024 11:48:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F47195FF1; Fri, 14 Jun 2024 11:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="E2cu7y74"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="hF4PBPoG"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="E2cu7y74"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="hF4PBPoG" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 963621957F3; Fri, 14 Jun 2024 11:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718365716; cv=none; b=Dh2RPI2GuUOHPGrdF47QbihUTWwIdD2ekz7Y3rypHyXxVoja5urP796gfOl1XAhcc01ggyE+6KgKh+IszCZrQz0W7kTdDih8PO7g64kyZWncZL6nUgHK/ObJmz6bSkxejTRukeiU+UQ1xNEk7y1CXMeTqYQf7mYD0PwW3qc/v5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718365716; c=relaxed/simple; bh=T96qca2RM0tVHe1VlsX3EaZMhWCFQOCkVyM4NNouzZw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fWA0soPYUcv+crIjASxlnccQkrO3V8UEfeuZkg9pT5+rYl69iGHbOMtDNBS7XONq887R8GG1PlpPUjc8inDbpU/jm4reu0Xm5i/rXUZ13V3r1B3Mpu8waRNMNUQ4qmBMxysUu4mhBfvpbokyTiY3MREF23yQWgA4KREMmY+O71k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=E2cu7y74; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=hF4PBPoG; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=E2cu7y74; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=hF4PBPoG; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B429320428; Fri, 14 Jun 2024 11:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718365712; h=from:from:reply-to: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=7CrLYCz09vrQoCSmw+MIDjSXKU5jzuAlXQ7QADNdyiY=; b=E2cu7y74loxlC4ul3crfB6HNmlw1hEtRE7E9Nzh2S4GqVGHZJOPn4tUQWOpiB5NEW5i4p1 7Ds5WICk5okNxY/YaC8Pk7dCoUews3A1jpugEak/HCDLoiDQHkw+AAk/SmlJjj2MWPIMGR 4Le4BhBdPJck5piK5ZAOq0c+8yHD+i0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718365712; h=from:from:reply-to: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=7CrLYCz09vrQoCSmw+MIDjSXKU5jzuAlXQ7QADNdyiY=; b=hF4PBPoGl+fsrCdF8GxGDGxbdAN0c79SSeM7/X4daQICMnR0MliyJE1M0mQIs+0Eg7yoxW T4qyukkhShatHvBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718365712; h=from:from:reply-to: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=7CrLYCz09vrQoCSmw+MIDjSXKU5jzuAlXQ7QADNdyiY=; b=E2cu7y74loxlC4ul3crfB6HNmlw1hEtRE7E9Nzh2S4GqVGHZJOPn4tUQWOpiB5NEW5i4p1 7Ds5WICk5okNxY/YaC8Pk7dCoUews3A1jpugEak/HCDLoiDQHkw+AAk/SmlJjj2MWPIMGR 4Le4BhBdPJck5piK5ZAOq0c+8yHD+i0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718365712; h=from:from:reply-to: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=7CrLYCz09vrQoCSmw+MIDjSXKU5jzuAlXQ7QADNdyiY=; b=hF4PBPoGl+fsrCdF8GxGDGxbdAN0c79SSeM7/X4daQICMnR0MliyJE1M0mQIs+0Eg7yoxW T4qyukkhShatHvBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 48F2E13AAF; Fri, 14 Jun 2024 11:48:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uvhpDhAubGaMHgAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 11:48:32 +0000 Date: Fri, 14 Jun 2024 13:48:30 +0200 From: Oscar Salvador To: Peter Xu Cc: Michal Hocko , Oscar Salvador , cve@kernel.org, linux-kernel@vger.kernel.org, linux-cve-announce@vger.kernel.org, Greg Kroah-Hartman Subject: Re: CVE-2024-36000: mm/hugetlb: fix missing hugetlb_lock for resv uncharge Message-ID: References: <2024052023-CVE-2024-36000-cfc4@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: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-Spam-Score: -4.30 X-Spam-Level: On Thu, May 23, 2024 at 11:42:30AM -0400, Peter Xu wrote: > I really don't know enough on these areas to tell, perhaps I missed > something. But maybe any of you may have some idea.. In general, I think > besides LOCKDEP the lock is definitely needed to at least make sure things > like: > > __set_hugetlb_cgroup(folio, NULL, rsvd); I do not think this is a problem, you are only setting folio->_hugetlb_cgroup_rsvd to the hugetlb cgroup. And no one else should fiddle with that folio. > page_counter_uncharge(), This on the hand might be another story: page_counter_uncharge new = atomic_long_sub_return(nr_pages, &counter->usage) propagate_protected_usage The first atomic_long_sub_return is ok because it is an atomic one, so whoever comes last will not see e.g: a half-updated value. But propagate_protected_usage() is a bit more convoluted as involves a bunch of atomic operations and comparasions that in case they are not serialized, the counters will not be consistent, which means that any charge/uncharge operation that comes after might not reflect reality. So I guess we could end up with scenarios where cgroups would not get as many pages as they should, or maybe more pages than they should. If this reasoning is accurate, I am leaning towards taking this as a security fix. -- Oscar Salvador SUSE Labs