From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381606; b=oM0kg2KrlBaAs+HYe80Iloni+mIHwXoG1gTP5lUK5chWiC+mSpwTc7x29TgST9u2mKS1 Mxzdhcnkt8aLaFg7phJtqsVjbHPdNwhtrTQAbVUP/H2DFGfZYWv22Jcmb5gScbnKA01B+ Nq1IUWdOz34T2WCQ0vSCtbqX8e60YkTXhYuV7xtbTXjLLHeGZF8SHMi6XeuKFLPHxNtcJ PbAPMrxLqBpexDdTAk0U5Y7+3Nj9TDu7wMFn8+OealMvucUmC0BVuUSe9myvaz6uejzJk 4yY0kUBgOGiaazGl6s0lBjLxsP0ODKmWDqIo6l/IJUz7hyymMsb3NM8mEEY78U76QMw== 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=FPfNzknHfs28XFBjiqqkMVmVcifrRpSLPqV47BKzXPq8vcCU6TX0GzME+8Y/s9xkfZnY VAAj3dY5gyIKn2nts7LFcv8jS8FlP9EOGssL46DbZqMlnOBuH8sW8JUxudT5K8PaAcP2u 7KUzhhk/BH/Z1tuFY0nm8a/ev/2JR8xBw3pEr8Wdpi33qlxQpavLD8TncLXkMyptlp0S3 g2I9rfo0YcTI6+R+panUiz6k1jLtUgWEwhaMQSruPatv3kEx91bgF0wjgXDkcnDi+smOA Kgsdj3oAmawr03TVANEValqJrJzpPN4YVwuJmbctLbLBnfqLnlMr7jjfXJGR0jEhQkw== 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.49 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 2B278606A332 for ; Fri, 4 Dec 2026 10:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2B278606A332 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-f49.google.com with SMTP id ffacd0b85a97d-4a68190a2a7so618623f8f.1 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=q9bIijYUqlh1Ac3ft27uahxXnFdhl/BNARLZhzSSrqYKq/Tzv+A+u0S8VfBlDHt/sh vc5LA/3+pTeBiftFgIbLDoHcB6YYn9su3Y1GnttMih+KV+RwZxJFuqfC1q0lvMw1Kqsp J7WHEsMInfNfa5xM/R8F1vqpQiQQ7TJxHpq/fF7Bm5R75u7hDuhF/GkGDBvK3Zw3rkRf f4cpEOzOapgaFKzjS+Tid3Fp6aqh1t937My/bG5MLOwwrLO52jbXPPrCGN9VEuLbUbYu sPcQsCityxeSoe0I9KR8yCc8iyTvWxScXhoisaRsrBfG4avcuZU43qAzwFXwU70L+v3E aERw== X-Forwarded-Encrypted: i=1; AL+hErHpapEE2BVDlzmqf8zC9X+NS/i7DitDE+s+tvHHTh8FeYFBFp9qhuh3g9ISHOaPlWBvbJsoz4BvYn8mQfAR@vger.kernel.org X-Gm-Message-State: APuU4Z+Pml3Mvpd+8nc77VjnPvelSqMEVL0zqVcOGhqXI9ZskqUdVP5p QHlgGnn+VOXbn6g0U91wj+qqkobHFmmolsbkTtWMIbsBX8joa3mfxm2G X-Gm-Gg: AZFdTZcLz1jOBGC8roypqoE5pSYkPHp1SCwsnXvDWaz8PrNqIiaKj6mMSQfKUsptF40 afKQSyanWGdGICEfCTUR/XXPzkBouXOytd9+4PLZZHWdSB9/2roxUpjtEodZdmb2g5RQ4TuBbJk 0XNtl13UOu01fTM0YPA7rIMoA7JDSiE3+lrZp5F5QRH9vZYYm1agFzXRXNHwOCF8mAZMRtfo+Dg aL4cb0O/Q2h/Iukm3i2wpD4dYq9hrtm5FCiBXPQREL2gwgDhHwA7ne/aR9/69aQ/EWSDyqwGl5J 1U4MUp9/Im/WwFJUiteX7pYl+VTwjAvO0nk+De8KQGeIty7kGVJX+RoL/PKvg2lpvs1yhduf9qt m9bBxhg+j7cJtK1q/1JfV9YfSjbjWPh6WE0j1y2effTw5S9828wWlTuqOmOfm+ntEch1cBKXYzX 9JtT0tTBjixaW9FViKoW0FcoZcJhiyd2RIYxEJ6I9qNIwIfv0nWRSL/ypkKi6V8akRE/d/4uLOp LD1rhyLHTu+U//C8n3NjdBZJCRUXLrRp8rcAZY7u9IZtvENgQUsQ2Fjm7FDKVk2c6g0agJ8g7dc UZXI2MHsh2ls3e2TogTxpqRNgM02sooAklInLtx+tJrV+enIpfSoU+A= 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-fsdevel@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