From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 0EC112F25F4 for ; Sun, 14 Jun 2026 13:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781442501; cv=none; b=KGALgU3HGle6K+F+D8C9dtTqics5Z9Pn9eOOtonNqLM4y5lpexkUBIwijUC9jb7jrXCEeEaVzvu8nQK7eGBPaes24mbvTHhGj9Pkicb/NuVvobHLoVoxBitICCgJUdQWJaZYv14gfXsbIimNzMmTkFKrW4mgzjrjh5eDg10xYRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781442501; c=relaxed/simple; bh=zCcv9MOOOHTxPw7gDjLOWlMtYn5V7225F/m2vJlTgFk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OIdPjNXUlC66eSgRknHD8CN2JT0iRXuTsF8gZ4uPevNAyblhats8Kc3uSuAKxFUJ6/w0+Bh/Or0cLceqJ5r56qsAKq2PZxjkdfQH+HupL9BiBUrcSmwYcuhjcvqsXvKdu6WbKBaWljKBJJbb4QfUxR1ghi7UQqxfPbXAmHRtjos= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jpd7WpQd; arc=none smtp.client-ip=209.85.222.182 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.b="jpd7WpQd" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-9185503e6a5so146624185a.0 for ; Sun, 14 Jun 2026 06:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781442499; x=1782047299; 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; bh=U3Z2uDchQ6KXV2OGuJ7w74+HBWtFtKyX+FjHZ4sgUZc=; b=jpd7WpQdMm+txs0aszsimyk5kbhbvBnP8q7TOQjGexHX+MBfCYPfSc5oEJ6mYng0Xo QfQ2d+FbJbI00gqxuoPlfwoO63ZUbc+Pk+PJWdTivGCZKQ1ZwGeK/7yISvt3kTQnMios cfR+z/FjLG8MHNOpqYI7I8gkPmwnQeUX1UadcKN2jtwElzEC6ZQmcZ7EwvN4UgFJXis7 1djiHJ0/OAQr9ZHaQORc2yqk41cnqznDDkdoJGTer14Ag8yPdrsIj78TZY9aCCfs9Ivn KSVtYeOVev9Ih1rcllKWIKq8YvkyJf34IkgUjn8b8EqhpArOz9psRxBqQLLNj7u2ZhTi xRRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781442499; x=1782047299; 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; bh=U3Z2uDchQ6KXV2OGuJ7w74+HBWtFtKyX+FjHZ4sgUZc=; b=kgMmk0amiXcTSc2hydwjdTmCK8K5sDO2sKomg8qVS1cBHUJQfujXzlwZQj5uTA1vWz 3K6w/gPa7Wre6LQw+CWU9fK2ux6Uo6VyT8vNwDDwt11bJAUUrdszDX8mWSp+qnf2n9y/ YNegGtO4HSZ8NEQi1lSm1E1hdaIOWLUM+uoT+c9F/X9HRl+m678vOnCNQFmc0T8nA8fg UHr7Azakr3DOkU1CFh322tXn8E+7I/xjJzABBagnY2RKwrbTKgf/+8nE/8WA9zaUfjVt Q5fq+G6ITME4rTH5wdyiSSwYD9qgy5u2g3E2Slky1Y70he/cB9ofrrVf3h+5uB61rdA9 Fwgw== X-Forwarded-Encrypted: i=1; AFNElJ+MOkyQE2+EX/fctW2Hbenf7g1ENUb0WVUOyez7Od4aP/R4fLe7RS4HCtDxPR6Q5T0hddhA+M31Rd6NeHA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4rTc+o0UVGuv6FQwr9kWHJXrhy09c00nyLDPHzpJaeGLjmT8s cNx1fvjdSzDgVNXAvczR64zmTkvV69DpR2IPI+x4wa/wIb0T2vx2SBYh X-Gm-Gg: Acq92OGnj7WdX2iyOXxomFBwhb8v421zPzaEoe9dHUdJKKuxHQWGFVrR1fA2QJCgtO1 bBx8/f/FWF7iVtoiOIQYI2udZAOAIbqlUYsPM3a6Fl1VGe5fVUtZl90r4tD/W1zP5c1++hyccXp /y5SGgGYiPQMzU2UXwumdetwHDwaMNhIK3CUcgibF+cdXwRNTcdWBlpVLeg9UDGE9fgI+vVMyD3 d5fke+aEFGZ8cC+MRWVDYLL3/vLV7gvNqOiuaEKwab60rfAM+J3GxwMF9Ufh9187tXI6Mqkqpge BxnAp7UNXbvFEe7THhPC+GzickzW2yTz1HZhN7L1fMBaVAhw7G4HsbkWNrkwYxm/fTTxAsuo4Fr gjHIKzTE3eSqEl1h5D2FuIZCBEMzFzBnP30YlSX4HfPaR2OObXMttcy5HVsAqWDPxPqNkorDjEc MM7XrhaHeSC74pFqvfP3aPoW7vlcHOOpr33HFyUrz0VJdaOsZnLAca8u0tHxP+0WFrLJssM3xmv kd4mpa38NrNdptT5t6k7P3wyn3VCFAukzE76E9VQu4= X-Received: by 2002:a05:620a:6313:10b0:915:8e2b:e5f1 with SMTP id af79cd13be357-91619dafea1mr943818585a.3.1781442498991; Sun, 14 Jun 2026 06:08:18 -0700 (PDT) Received: from server0.tail6e7dd.ts.net (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8d301b2cf04sm77838966d6.16.2026.06.14.06.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2026 06:08:18 -0700 (PDT) From: Michael Bommarito To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] NFSv4.1/pnfs: bound GETDEVICEINFO notification bitmap length Date: Sun, 14 Jun 2026 09:08:12 -0400 Message-ID: <20260614130814.2521819-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit decode_getdeviceinfo() scales a server-supplied notification bitmap length by four for xdr_inline_decode(). The 32-bit multiply wraps to 0 for len >= 0x40000000, so the bounds check passes on an empty request and the verify loop reads up to ~2^30 words past the inline XDR buffer. A malicious or compromised pNFS server, or a man in the middle on an unprotected mount, can drive this out-of-bounds read while the client decodes a GETDEVICEINFO reply. It is a read, not a leak: the loop only checks each word for nonzero and returns -EIO on the first, so over-read contents are never returned. A conformant reply uses a single notification word. Patch 1 bounds the length before the scale so it cannot wrap. Patch 2 adds KUnit coverage and is offered separately so it can be taken or dropped on its own. Tested on QEMU x86_64 with KASAN: a Level-2 KUnit case drives the real decode_getdeviceinfo() and reports a slab-out-of-bounds read on stock, returning -EIO after patch 1; two benign controls drive the same decoder in bounds and pass on both stock and fixed trees. Michael Bommarito (2): NFSv4.1/pnfs: bound notification bitmap length in decode_getdeviceinfo NFSv4.1/pnfs: add KUnit coverage for GETDEVICEINFO notification decode fs/nfs/Kconfig | 14 ++++ fs/nfs/getdeviceinfo_notify_kunit.c | 110 ++++++++++++++++++++++++++++ fs/nfs/nfs4xdr.c | 10 ++- include/linux/nfs4.h | 3 + 4 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 fs/nfs/getdeviceinfo_notify_kunit.c base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 -- 2.53.0