From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D79134499A9 for ; Thu, 9 Jul 2026 22:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783634706; cv=none; b=Gs0nLxs7usCCXCJ2n3QSjyVTWYHkGeXAMJZwKcoOkDvKlMPDC31hVkj96ks85zuzARKyCJYOTetcTP8EY9Pitlq6LiL9hkdPC8Kj1s5+f4agRZ87VQl5lV73U7J0kujvKRX79jrOT/imlOaSEGQk57AN91n/4q+HM6FVSFSVFnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783634706; c=relaxed/simple; bh=GWzCqgBdnzrCXDuGs1zCJaaPEipz38yup9Q20fHT26o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=a8rTzh0zGtzSkAN+kw9ILxchyE+AuS51Mpm1fZbYWY0rO8uAxJGKipkdlD3dn7ycxQjKz2xCWQEk5bSGRt2xIwXQrQLNQbPNNWqTaRmbOu8nkDsQ69YTQsUiQ6bJmy00zy6JAtlDa3IQkvIxJ+VoydjJ0PaDGt1jl5uGFSIBqxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu; spf=pass smtp.mailfrom=asu.edu; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b=lpFOli7F; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b="lpFOli7F" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-ca2fad0ae38so234736a12.3 for ; Thu, 09 Jul 2026 15:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu.edu; s=google; t=1783634704; x=1784239504; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Rb6RDuAYsdeez60Ddc+s7DNRi0KrVtOV9l66vIIUTlg=; b=lpFOli7FKc4+9U/REL4bwr6XvQ+EbJGR6U9sJLrA7VK+x3AWi83xS5Ea2x/OgiP21n feeprQeeYfpGzPPe/IgPojTtMA9JiYudnE2hKvdT8fIQVZC31e67cvBOAeGNdC9VWHUX /yR5Sry42f36QVJ9Lzyqg5oZhit1tkeprYDqELnOo+POg4DcFNuOIwqGiMxnmWOW5X+/ yh3E8zvaJADKcXqYxkA9xi6tp99calvReUXKOe038iaxB9toZ8UWOA9lvqHkiI9mvi3q w1Keljg+yDuHzjAyq3c5sUfbN+IXlvKWHKFFtqWdwVDAldJU6XeKJeBD/QcXj0Z7UBbj CpeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783634704; x=1784239504; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Rb6RDuAYsdeez60Ddc+s7DNRi0KrVtOV9l66vIIUTlg=; b=PW+EBHfzURL71JON+7BXDVGwSGvhpobBO5DB6DWCMGFTYZSuMEplbEIVxmlsCxh639 v1LmIb1/UZmQsOwOYkrXW3TXn8Z3Hvijc/xUCJTK02u3/wdTHd8N423wsnBR3eht9Yds yk6148SJKjlRnOuYjiBb09h6sRiM6jjjH52V4rHnuxtbYRFQ7Nmd6t6weOoXaOWswrfR e0ODravVPpny0e3C53SdV0V7lVRWCCcZvxiC4bFmceMT8jNw7txsDoGa9N+Rpz0+Hc2j PpAGyCKg9QPU+avvDoxt3iBYAmYsDWaX1qcbIXGqtt5dgZ5O7t0EcCRZDmMvZSakzhXl ZT1A== X-Forwarded-Encrypted: i=1; AHgh+RpPN3B/vwVors7/zOV3O2hyWNZK73ol0vqp4kOhBsCD5ceGPsYVLYKHkFdsge1NegO3ZNqdMDH7FMA7LEQ=@vger.kernel.org X-Gm-Message-State: AOJu0YysMl8ZlrTXRNkNZtNmvK6Cf9fF68gSQtCXGrOhOcLvo0+9bs9+ b7/u4BA/3l27RHgtHv/PAcQMVRB2Q2LaO7/CHTUmC+rHqZcFOnJXml6qZ9HVXqKm9Q== X-Gm-Gg: AfdE7clYEtqb9yBOd6vEQZ1aJlSzIIlBZoG5pJkcUK6mD/WGCUowxhLPul8MUu9xGch TuPpvVc0bDW1kHu2LeqGfhVkwdwiVcVCK9lhcOtYb2rP/DZh9saQpdr2MgKKDAccVz8ccMJYhsf 4Tx+q0FZZukd37QZ0lLNLobOEqo46gVEdxmp+Cv3fn5mI2zbMJKTN5sWXBdERdsmWxgdN4R1rvZ oy71n57pyN4xAD7YCDL6kUcgmjGU1wZm0JOOkk6Gy/Px65WRKuzfizssFeOQAkZuW98QNSe2Q43 Od6SVQ1VWVJavpnaNHSXpVFVNQXSJiXrk3CWP85WUhE1BM1uyJyBf7lI3Gyf3Q8+XHko7dua3nK A16cznvaBufAcJ5wXgoYZvbZSfOjZuYmtJ8pAGD29CFbexFlVJyGZmfxswMd1ZyQ9KLQvHWOT6y 5J1qd5H+YrtRSiwyOYrQ== X-Received: by 2002:a05:6a20:918e:b0:3b4:731e:6f95 with SMTP id adf61e73a8af0-3c0bd206d33mr9703927637.39.1783634704083; Thu, 09 Jul 2026 15:05:04 -0700 (PDT) Received: from xiang.tailc0aff1.ts.net ([20.171.14.70]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b659d8da9sm57229945c88.14.2026.07.09.15.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 15:05:03 -0700 (PDT) From: "Xiang Mei (Microsoft)" To: Konstantin Komarov Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, AutonomousCodeSecurity@microsoft.com, tgopinath@linux.microsoft.com, kys@microsoft.com, "Xiang Mei (Microsoft)" Subject: [PATCH ntfs] fs/ntfs3: fix slab-out-of-bounds write in attr_insert_range() Date: Thu, 9 Jul 2026 22:05:01 +0000 Message-ID: <20260709220501.395659-1-xmei5@asu.edu> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When fallocate(FALLOC_FL_INSERT_RANGE) grows a still-resident ntfs3 attribute, attr_insert_range() shifts the inline data using the insert length 'bytes' as both the destination offset and the copy size: memmove(data + bytes, data, bytes); Both are wrong: the shift must start at the insertion point 'vbo' and move only the data past it (data_size - vbo). When bytes > data_size the memmove runs off the end of the data_size + bytes buffer and overflows the adjacent slab object. Since vbo < data_size is already enforced above, the reworked offsets stay within the data_size + bytes buffer and cannot under/overflow. BUG: KASAN: slab-out-of-bounds in attr_insert_range (fs/ntfs3/attrib.c:2581) Write of size 512 at addr ffff8880135e8b10 by task exploit/142 ... __asan_memmove (mm/kasan/shadow.c:95) attr_insert_range (fs/ntfs3/attrib.c:2581) ntfs_fallocate (fs/ntfs3/file.c:618) vfs_fallocate (fs/open.c:338) __x64_sys_fallocate (fs/open.c:362) ... Fixes: 9256ec35359f ("fs/ntfs3: Refactoring attr_insert_range to restore after errors") Reported-by: AutonomousCodeSecurity@microsoft.com Signed-off-by: Xiang Mei (Microsoft) --- fs/ntfs3/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index c621a4c582f9..a9a2c2104fd6 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -2578,8 +2578,8 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes) char *data = Add2Ptr(attr_b, le16_to_cpu(attr_b->res.data_off)); - memmove(data + bytes, data, bytes); - memset(data, 0, bytes); + memmove(data + vbo + bytes, data + vbo, data_size - vbo); + memset(data + vbo, 0, bytes); goto done; } -- 2.43.0