Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1477468lqm; Thu, 2 May 2024 16:58:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7VGjm0Awyo3afpZiMozmYgxT7xam6+I+TGBf2ddSoB8g+ZGnhlzicMR5RfPqvUvZesUHCAbWHnxuRu3qT5vX7sTmQ76J4a3UvsLemHw== X-Google-Smtp-Source: AGHT+IGypwNu8OllCLf2LOuyf9noJHJAHX18CaEpTPfzdJHFW3ld9tq315YOg73m3MSFr6GNZihZ X-Received: by 2002:a05:6870:c6a4:b0:23d:fb17:c9a7 with SMTP id cv36-20020a056870c6a400b0023dfb17c9a7mr1542215oab.48.1714694325802; Thu, 02 May 2024 16:58:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714694325; cv=pass; d=google.com; s=arc-20160816; b=GkzJ+Nrqxtt7l7OTTt/PqDLK/SlwrzRCz74smlU6mPY7a6fQIRVJpAuy2zGlzXRAtk jtt4gFuutF6Sh558h8Jbchy9vniIkXzv9fdTwqCbfmweYtYqq5AXIMsBBGO6wPpwi7cS a6x9m6qC9u/3/EA6miyK7MFt9bZfEQWMdHY7U7tcHmQqBgPzF1bk7nWNAk11j4DusJfA VNsYw6DfaLNRzzCahuLWZbPlJs4biMZalM2yzf1Q6Pl0YpFpMnlHWdghBWfTLlnAJdTC Ejc3cz95krUf1SJ60i6wmsu8Tw0Cg7jQ34+lD04Jkv/f6mL75VnCKhdwGYHugNpvr0KH pn2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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=ULmPR6hNHGKvfw+x5JwcQb4TEP/e6WVplfSdLUYOMgQ=; fh=4ju/sbQ98gwaxGjZBNIZUzZfMrxGD5BSlxjcUF57YM4=; b=Z07vHy5K2UnmL9Xp8OAGPlpC5Oaar8rPvsH70U9/dYhGASLfjegXYTKAtapbAMSvJe NQTnE7aAmQyoxxXQdrszFcBFkGr+odDMxzcaDt2vUK7Hr1+Z+oUefMUk3Lp58mJKfDwk iohXLiNlo1CjoQwcVRMfHqcH2nbFIrN1wS94YZLfPX7uKC/fu/jwfp1dnjWJsHThENUS 0bDQzYTdyLewWbA2s+yfm3dm8csOZ8lzu1D7m2dd6UvAhWevk69Dcpip6LOwoYir9tTG 3yHlmj+uQvGf7QCXvsR7du4yRGRuRJHadr4bkwpby/Q3gzvMtJAx8ne+7M2X66QvTPaX HfYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=NNuR3eFN; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-167014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x22-20020a62fb16000000b006f03011c97bsi1831801pfm.113.2024.05.02.16.58.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 16:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=NNuR3eFN; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-167014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 841AC2842FB for ; Thu, 2 May 2024 22:43:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D1501BDCD; Thu, 2 May 2024 22:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="NNuR3eFN" Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 3E0C957C92; Thu, 2 May 2024 22:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714689781; cv=none; b=DS01QHiTnVln56ezEIyXmVCupSLEzEh5vdEJuDpCTj6ca/0shJM4o/9n8M5Odv/n7+UELyWcS/xso1HJDCKEKeGSLytnP/Wdr35mQbzAhlqzbccvaUoO+4zQX9zY77SwrJ7rMM1wP2MqdI+3cczrLz6vCzSF1YsCmOjpERLiJMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714689781; c=relaxed/simple; bh=xYzraABcVwLhbPKPIv+CnLrEEfApFOCv62m318pkhXE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FDSaSq19nT9fKU8I6zSk29iO8sPDilV4yPXppCyTAiry5hejl8AgYk8z9MonvMM2aU/SzfFmEtJn5u1u0dsu8DsBgI6/W7QkpJnCVFcH6fL/9749PnMn640a6BWXEp59YTmx4rCLUwEGiiFi/n7XsgR0OaJNmM2NtWozU0gDBw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=NNuR3eFN; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ULmPR6hNHGKvfw+x5JwcQb4TEP/e6WVplfSdLUYOMgQ=; b=NNuR3eFNcyOS5w/isy/zTLRRaO onkClByWbmCmRL22TUag18at6tRT063x5web+FO3DofpsddeR40Fxrmy28bSrpWv7i4p+1yLeikpn EYbpPlGUaFPmC3sMIoJpMg8TQeMrNL45IYY9piBB9jmaMTUtNM1s//whrWuNmUGA+zygfNQJ37d/i Vkf//jPzrLoKGrzTQ0duPSTjOCODLfcBJjIBJqJqXbjsFGJq2qCgCqfUWSbAYzrvnLWUFE6cKzOyz 1PUzkElvAPYcXaYecp7LqBbN9Dzk1D0oicseeFPfjzh2181gcIvkDpOuetjBnt4NaFS63aMLfea70 xEGx9oWA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s2f8c-009pC0-1L; Thu, 02 May 2024 22:42:50 +0000 Date: Thu, 2 May 2024 23:42:50 +0100 From: Al Viro To: Kees Cook Cc: Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org, Zack Rusin , Broadcom internal kernel review list , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Andi Shyti , Lucas De Marchi , Matt Atwood , Matthew Auld , Nirmoy Das , Jonathan Cavitt , Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland , Kent Overstreet , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Andrew Morton , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 5/5] fs: Convert struct file::f_count to refcount_long_t Message-ID: <20240502224250.GM2118490@ZenIV> References: <20240502222252.work.690-kees@kernel.org> <20240502223341.1835070-5-keescook@chromium.org> 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: <20240502223341.1835070-5-keescook@chromium.org> Sender: Al Viro On Thu, May 02, 2024 at 03:33:40PM -0700, Kees Cook wrote: > Underflow of f_count needs to be more carefully detected than it > currently is. The results of get_file() should be checked, but the > first step is detection. Redefine f_count from atomic_long_t to > refcount_long_t. It is used on fairly hot paths. What's more, it's not at all obvious what the hell would right semantics be. NAKed-by: Al Viro