From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381606; b=M7t0uYb+0QMM67LZLUVZYwdwPyX/fGc4tTtD9ANpJPgYnl4Nca4RZLXqfoJ+cMuKj16x 9rhRn8Xs9fXoMPnjwIq6eHfbWNST2qq4Qeral4fsMaJRjiyPyndVENGB0DJL7uWSazZUU T1xXaqnoQdjXlhAk11nBWLZdneoy/YBIske+TR/EVBswuighIpVdJwRwLb68lCWuXwSGm bm/xujlGxGmdHD5JmPReQIBd5W74jhGYpgwyCEdNgcl+telzoef4DVU1vjMf7ehZVj9XI 3efXRpMRNX4Tnk3XS8wO90MtFvt4zY6Ojuf0blW37mbx486q2wosAEFe6Ar9ZqQysmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381606; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=iBr73E95fHKhyrIwL9Gp8Y2yZpH6iFicFvBR+bU2eoU=; b=pujRfER120xtfLdPWGe02AlE4jztOhxQsUZ4g4782wj2bP3wSvw59bgxrnPFNPOu9mRp DzIANEK5Rdsd46i2lIwSqMI9MNTWaZUS6T7t7eYaizqNkr28skvlumdoNGGiMh3Ku9Kkk D0vd0aoY0tUUpawRAI4Mk8AK9766xJMY6kCeYxy6IBbjiWBzJz2BIYhpk2K7sqwyYE/oe +OXsVBGCsDeH086LtJ8lSTy4Kuib3oEfJfwRxIyPinrk7XrB55iyGDoPLEDiSPCAtg/KH oSU7BQLoK+ojHOojuI+ErxyK/1iXyDFwIeeoCrs38RawfhOh8NkwnclvEtxdz2lcAFw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EY+loQov; arc=none smtp.remote-ip=209.85.221.54 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC976606A32D for ; Fri, 4 Dec 2026 10:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DC976606A32D 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.a=rsa-sha256 header.s=20260707 header.b=EY+loQov Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-498f5fa4f70so727387f8f.0 for ; Fri, 04 Dec 2026 02:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796381604; x=1796986404; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iBr73E95fHKhyrIwL9Gp8Y2yZpH6iFicFvBR+bU2eoU=; b=EY+loQoveTiSOnaBmd+kzrxMgm8puA8GolofhXnRuB7rdHh2Vs7rpUKXLYxikuZgP8 m2NEzptebVGMsoMe7TfjR1Ur7iUPg6YUDPT0aBsOddsOh74ONoUdMYlh4HYxC994nIdx 22EJsm4IRyImmG3Dva/UYCPqnP+oXf9gqrtihQbNeJZHinELx4f2UQoBym7Yux9GmK30 AH2KAcL8VXj2GWT0XD5LpG/Gxbqpn9IPx/2e+cNuzl20y6GZFOxpvH3QECeKsL8YvOcl K5UAq0k5D9jYz4ct2zk3p9JAiEDl3Q8RiiP5Y2ZUeda0vtRmTj/1TtD4ToBy/a3QkwFu Sjxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796381604; x=1796986404; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iBr73E95fHKhyrIwL9Gp8Y2yZpH6iFicFvBR+bU2eoU=; b=iEItBVfmtz+CapzT4W/xLYoYHNaNXq3H9t8RnR9LQW7cAyZBWLD/rU58NgdGGhemRa mTWoqOxK1AgLlcyVx61XLluSIuNY7xAmNlEXrVm86So7U4SQyr8WDYcc7XyRBKC+DuPJ GYOlhV7D8mG4w/mJRG3Mgr53TO1j3YVWGdO8gXEbGhzOsFubaMfB+CXES70ETnP/06eX tiAsjNr2FV/WvEnvxiV5GYvXASskQJwhIevQV0spC0uktgEUqTg6ensdOMJMHxwMyvPB jw6TSIYxxE/oaynPbVdzsjMctsP71ixd5AADVxY5TkJ+wNeOVwlPGTkqb6pUULL9ft5o M6RQ== X-Forwarded-Encrypted: i=1; AL+hErE5AwnE+Nod9CZxm8hPgKFBuey2DsTUHllLmD1HhkyZfHtO8EZTDKCN0MO4QpK72v5FpvlkIL3A2NDNaDg=@vger.kernel.org X-Gm-Message-State: APuU4Z+ux2gM65NMO/92tqrJRTHgA+pxj+WL5WhqwleniddX2XwT6G+Q VUIbAa03DQGWB7lzWaa/H4sl82YFYIjjfiXfvGqGRm1eGnhdlsYyabcQ X-Gm-Gg: AZFdTZcizGg/FPTFGufYXz2omRPY1taQcHHHeCHjCFPULSKwU1tJ9uj4kH9JgcCdJbD I4ZCjrcFDFAj7iZX4fx4AsJQ36VtfW3LnnodUwM/OiIKtnXlZ3EREfMrE1iE0j64XRUVV6cVILQ 8Dc3pFj9GtCNbMHF90frHf5s8UMTEg+tndO6+EH1BdMaInJNI2XzrVhIeyl7MLtLAUZAVvgAL2i 47gPWUGkedKW4OrPUghpVDH5bGOgreIWL0jZhOhK/kKnty+JWeeAjjgP1q+bjrXz6H+C1fFJzX2 xmqs96Xc1ffoKkahOBpsX0tZfvNpxmQLynXY1q0nOUaQtywK/phNqVgzU4zX6ZJg2DIRwizFVp+ 68ZHnpXx7Qtk97tcwEaskIGgRTt0YmsGL1M2aWUDz39jpx/JzT7XQvblzHCHqE3T1rO5l4ialO0 1R7Z7mqJax7zlzcf0+2CXkHpn55XTnZnrNaGBRxna4fmpjOyDsjZ+YLTMwvcaR2nSpEKWUslxlk gxf+/+rr/VYIAOsGcCs3Ir7rY2b5uKgDhGRyF3Mbph6Ta9QW9nsXp5bnHoAMDPxuTNTXd8sD5NA LekPNNFevL5U/1iSNeWZyXPbcLH+StcjGCiNyb9svqPnKg2DoqXdIaY= X-Received: by 2002:a5d:5888:0:b0:487:1ac0:32af with SMTP id ffacd0b85a97d-4d1ec91ac4cmr3015703f8f.51.1796381604293; Fri, 04 Dec 2026 02:53:24 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d173ab8d22sm4702788f8f.39.2026.12.04.02.53.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 02:53:23 -0800 (PST) Message-ID: <00d8de05-5a7e-4cd6-8859-35df8436e138@gmail.com> Date: Fri, 4 Dec 2026 11:53:20 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 12/35] mm/hugetlb: fix truncated copy result in UFFDIO_COPY To: "David Hildenbrand (Arm)" , Muchun Song , Oscar Salvador , Andrew Morton , Hongfu Li , Jinmeng Zhou , Mina Almasry , Davidlohr Bueso , Naoya Horiguchi , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Vivek Kasireddy , Mel Gorman , Hugh Dickins , Baolin Wang , Dave Airlie , Jason Gunthorpe , Andy Whitcroft , Roman Gushchin , Barry Song , Andrea Arcangeli , Lorenzo Stoakes , Suren Baghdasaryan , Shakeel Butt , Pedro Falcato , Jann Horn , Guillaume Morin , Yang Shi , James Houghton , Rik van Riel , Harry Yoo , Lance Yang , Axel Rasmussen , Peter Xu , Sasha Levin , Kiryl Shutsemau , Christian Brauner , "Steven Rostedt (Google)" , Hongbo Li , Gregory Price , Zi Yan , Joshua Hahn , Rakie Kim , Ying Huang , Matthew Brost , Byungchul Park , Alistair Popple , Andi Kleen , David Rientjes , Joern Engel , "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, Gerd Hoffmann , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Chris Mason , Jiaqi Yan , stable@vger.kernel.org References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-12-9bbeabb555d2@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-hugetlb_fixes_2-v2-12-9bbeabb555d2@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote: > From: Chris Mason > > Folios that span more bytes than can fit into an unsigned integer (e.g., > 16 GiB folios on arm64) are problematic with UFFDIO_COPY: the result > from copy_folio_from_user() can be truncated, possibly indicating > success instead of an error. > > We will then continue with the folio that has stale data, and make it > accessible to user space. > > For example, if copy_folio_from_user() fails such that the number of > bytes not copied is a multiple of 4 GiB, we'll get an effective ret == > 0. > > Let's fix it by simply testing the return value directly. > > This has medium urgency, as it's an information leak. > > Fixes: 8fb5debc5fcd ("userfaultfd: hugetlbfs: add hugetlb_mcopy_atomic_pte for userfaultfd support") > Cc: stable@vger.kernel.org > Signed-off-by: Chris Mason > [ david: cleanup code and description ] > Reviewed-by: Muchun Song (ByteDance) > Reviewed-by: Oscar Salvador (SUSE) > Reviewed-by: Hongfu Li > Signed-off-by: David Hildenbrand (Arm) LGTM: Reviewed-by: Jose A. Perez de Azpillaga -- cheers, jose a. p-a