Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381606; b=NYA320sczEcOf18CqfneObwpxMdXjMEEe1OQiKPAnktCHDyHrvyRkvjDZjk+pnK313yx 2e66co9dxzXULuTZ/Xl00yjkLV8vtpZdaBTlL5XOzQJr7ed+MSPdfoglVQIUiMX2f7HpI xC3M6zvKFDBi9dL0ZNJ7LX9WitmjFQSBMr+Sdg56pV7qULPmmfySkaLRFyV41tUV1cYta U164L1JeTYtIegpKQgDs+9qQjpDSjTRIBI+Wl2M6tNH+u8i6u3q2Q6xlKD6NxLe0w1ZC9 pNBqHiYgU/Uw9SJtVMBm7Wj26PwDhYkaCTHXwJZZGhecE1XCbfUwG1r3k+nYRP4owng== 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=AU/B/+fdOE6WstGu4YT3Vsd3h9sHHLsKfUsA7jwqIbWtEa8IA+D7G/KeSdyhTosrPHcv ldf47X94msI831FfBo7KzT9l6bCcF6L1MOHKG80JsXTVEqT4x1s9n1IPL24gV+/Ih4FPf t/ZDeNU59yTXuC0tMZFaGvw8eoLQj2s/8/G0WXTokmrWmO6M9NKY96th33upAMN2ye58U 99S8V+e/fPsRvp/KYdIrZtUanGWnXgI0AyyzjkM81QH0LQveGfbmxbbQaMuibZJQ1vZj1 aAdDym4+Ar8TDTbwtlb6+pH3FNEleMeCK35Duc6On2Rp88b5MSQ1hQGTSbzpZdGo1eA== 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.52 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 1976D606A322 for ; Fri, 4 Dec 2026 10:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1976D606A322 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-f52.google.com with SMTP id ffacd0b85a97d-498f5fa4f70so727388f8f.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=T+yrKRHONTsTds07ngkWpVdm2V6Ltprsk+OZKfaFd9d7/Ujod6/5JjXvQ83xKY6a5H K+LM21/XKsmeYixmlyRE/LH/No2VB7NH1Zx4ExAU1EkavE2lkDrk3bMeXSY17jrhJm2P kS/8ZExHEa1fPSDkilAZv4/4n5gaGX7VV3JTubqYOKUMFAkrT0u9D+KDoKZjo9OjB2T7 xYNKcBCntcwL52WI9LTSOOtNrNdwxOP2ixdnD3GG+sseP1PtW6mRvLJM3Zzpcj7Ifp/i afMHpDQGQ0Ow1HVeAocnLP7McOisjKt1/7iX43vFIIGCIK23FO+f7OspXwcbkVTobECp hm/Q== X-Forwarded-Encrypted: i=1; AL+hErE91TOFoFm3TjPsy/m/OyyTFU6Sr+1Bu7P07OHTBQmFlytZHnp6oaGR3sEJVdtjgr5YX969XCBTVLo=@vger.kernel.org X-Gm-Message-State: APuU4Z+bGphOMud+4IKHznsWY8Zqb1Xk65IxfPSD21IslGdwitvyyQhW 41orpasqqg0AXtWRiXHNg1JzJc1tmbui6a2dQTNyN+C7bic/KDKhAuWe X-Gm-Gg: AZFdTZeECDS2xSye1vCiZZmQjiot7wFmhWqCQ1eLDE7RSdwnC4VtEq9cqOKJe81fIfU dxyyvctBGmB8N9/N0YNejPFWqT8PTQ6K/4S94w6NuZrOOSnuE6n9mO7euqgnTnxIssmGOYrF10e HxNA4qBkC47JNevb2xlYnqF2ZKG0wRD4z+F6xqA7mSuCA5kH95bl8qwmfQfNBqxu6KWMzu3MW+X Tn7C00hWFZlA8QAjxDMMyXvoVNhUPi52y8EHgkzr2QXtQnl37DcmDsgJmkZTEC2GJVNGDmTGwiV 1KIZN4ureAONU/Jr3VH/p2/7EYOmqH4i3dGxKoJI2sSUlgrJP7mG1k5f4p+Wc8hOdxboU9nD55J Hfuo7NZmWLRJ+Vu7uSjyjHoybmQN9VPqRjt7I2dEz220enRSYYh3lqOLYKCAY9FPbNpMpzRj1nU ZPWbnlH+ECpTx2jpf72fa2k7j+skyARKov9bNiwsWUMg/ZaPsWlkPtkczW2EpT76lTHFzfnfEO1 WQmN14j7x3ECeV2Tdpqp1gyi1O5bHTpNsqEdxfwe63HWL4S28+dSb++H07+1Y6iQqyKn0nC1A4f +coxaOgpHjWLErKQPjoJwf3drgtGQGQhaeOYO7wSK+KK27W5wHtaPaA= 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-doc@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