From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381606; b=D6rETS86ccFJPzLq0Ky385m4e5eJ/L8gYrfEcO5cQWsqJ7GWnPuJcXnAX+Jwuk1dHyEv 33VmODy/78JC334TuZel4y4DOe2hGyMGri15vPCqp/fdil8smaFlCqr6lGY5GKd2QKHjQ fClk2hgA27apoIRpXa9VPHaQr5w7rl6jeFpXe8b9q1VT7X2HVcqF23sYoPgJRcR6JvN5P h7jkNCv7v77Q2pcsIWtu/48FfYjs9dQOfu3x6P3Q3X7qlt6791IhulC14bGfauK/VKuzD Inx3jtq9eg1Jwy1eZPy8b6/hWeXyCfXW+qNcKjYjzTg9sFBdLZpxNXBkh7by4KOHF+g== 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=MBwW0M1ugNy0eHgyOpxYIOdEKJtMxTJOi/qBkHTH+qwEDQt+O2rXG1TfsqP4f6Ni++Si JO/R693QfZf/Mcp5booG18Lur+nLllvwxj9Qx8de3NhnCJ16xjEt/G6xhoy+fkt99bsgR a7V6SorItKA7fhcSbND4+glLjT+CsbSzpRgw+hqgwsFm7Htw3VDnPebbNvTvHNO42Fuxb vyWdU5qMOe50MTkQJx6TJCAZBPB2qaqbAWmYYsNWe5fymUpWavfvMIlkWuI5PuH6Y3Ktn OEda33K/KKQjx3EwNYNz5sr4LMMbom+s64XISEaBFtY137mZ3k+uuBWXYP5T+0RP2bw== 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.41 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 E8623606A32C for ; Fri, 4 Dec 2026 10:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E8623606A32C 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-f41.google.com with SMTP id ffacd0b85a97d-491971ac844so717690f8f.2 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=CHDSuYSExTmP3BryTeIS98oD4DP+/cjHCwDbWqt7w3u0uBK069kqvfcuPHQFdzK+Qk N09MkAOfa/UVCp7ERoNCuHqsylRRLs5mFR3473MddNLBWArW0oUlST2+IRqKaQkIBRaP X1GlOBG89jlyobi0DZEaFvvOELShaJH3EI7NrfQ809e7Cug3DHsv2c+IFrYNhqDkawgc Ypi3+K4V2yhEVArnF6mP7pyshxr5W09RYk6g0iJIpHSRwyMMKaHfO60Mm8HRMSDHurod lGWLHt61w3sMwKQQ7Poy4C1S2piMjr4WDLkUTfJnbRGujR/2T5JESfPx0tnPvCowx1zm zrZA== X-Forwarded-Encrypted: i=1; AL+hErFa/eBqzHX8hSevved7bHOPcfdrfJ04cJ7HzjKsQZ1vEh8MBmXJHIC6/q1r0X6xrzxQDJnw+7A=@vger.kernel.org X-Gm-Message-State: APuU4Z+wuCK5e4aaRcWzHA5H3+ajhSsuu/GvMBHAybFoNntoGqpUnHlj ExuqNPfLPKsodS+8zczMJZC9DqqrAFtLj/japwU6LYdRSke5suWeRSeM X-Gm-Gg: AZFdTZdEd056+f9rwTAFaj1kMeLwVI32KONTclPGNYSCaRPjRIWGYdmHUGTRqHhV3f5 GVpM0D2cxkAPrqgPxPN7Ax+nEVeiC8h8+0FYjvcxS4XC5bt/i1YDePbVzL+mGDgBeNMt1Oy5xAv rMz7b7exaqeBQkuDGOcMzdZSXm4Ixnk9vC+xaRkElASZrMBGUqQNHti/dnNcipq0O+yZecIPLqm 3orzKo+9djy76qBFmc/KKDQkHTdtZtH7KtelMOjp041b9qLTHswwFxx/0otOyIDalqWarrqvgT9 //B8H9KideScVOq8Pwe3FeVic+WV1Tw/SyBGozMbX5cXD6zKP+sEDCKV7nLuFFcdGusFLUL/aEz A4VwRoT4OXhWE9I0+qZ+xMKDBpE3I2yULfJ3pMElxRpnIlQ6ExZpgkCnmQGdwDVr7LpBFiBOzC1 satnBcSDBJrNw8ByYEFNZkUmKYI1laKY5giv6c2oNWf6mNLSYA2K50X30sjRevPZBqNy8zBNnjO qT1tS/lKJuVfhtvbyEQ+1G3CbwISR1y+j7ba/GtVIgZ7+S5m4/PtU06B8VtpPvNiQEUteEHU7ww FNDdD1cAXGv6L5KyzrtZL8FN9OBPw0E5Z9L2AjTExsK3JLj5MvYlmB0= 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: stable@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