From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9693A344D88; Thu, 2 Jul 2026 16:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783009366; cv=none; b=HkYmNHKVA+kwi31XNizwhO46u5V0/bOMGybVCAsb9QXgBB5p/yFaxSmCwjcKD3TKtmZhiw09p6zf4myO1Z0IlvL0g5tIzpJBvsQ+MH1v/ew7715vdYtQQQK2Tf1V8V/2iUXACmQJ9I2ZNQGyqG5x2kkK2qbZVymysh279t5qrjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783009366; c=relaxed/simple; bh=mN0w+mM6hO1xANnT2RpX6bkba7pcj14XouD2BzQ08ZI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=leQHUInQPivKMRRqdBc0dl6/lYLJphLBsNLpoqMdglOhiPbA1+o7lxV47Cmx4RnJ04Fvvt1GV3kK2dSc/ZAwZKFtOWMHh8himIAhGXo5tJkvRnKFxO5GZOtopGVoYDZX+6ib4j37KGGO5UsXkhYub0Gy6/bQHchIIVhAUCZC8e0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nJsv7nLk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nJsv7nLk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F2B51F00A3A; Thu, 2 Jul 2026 16:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783009360; bh=rSmaeIMHSe/ck3Mjv08U5XlpJjWqE4TQKTZz5IxYwlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nJsv7nLkjtSr3mX1ExO9hxJU9sF3hhgt+KrQCuELuolgHl0hTmi7JisK9B/otovHA d/sbpKKysNv8+A1pb6uXSyw7Tfa5gZVDUKzloK+5GbV829AgbdWDEHAp6ZfmFtKb+R j38dvGXhkEgwucM12C8vtLrS7C8LXt0/Se0xIZso= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lord Ulf Henrik Holmberg , Leon Romanovsky Subject: [PATCH 5.10 22/96] RDMA/bnxt_re: zero shared page before exposing to userspace Date: Thu, 2 Jul 2026 18:19:14 +0200 Message-ID: <20260702155109.451285063@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155108.949633242@linuxfoundation.org> References: <20260702155108.949633242@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lord Ulf Henrik Holmberg commit f6b079629becfa977f9c51fe53ad2e6dcc55ef44 upstream. bnxt_re_alloc_ucontext() allocates uctx->shpg via __get_free_page(GFP_KERNEL). The buddy allocator does not zero pages without __GFP_ZERO, so the page contains stale kernel data from whatever object most recently freed it. The page is then mapped into userspace via vm_insert_page() under BNXT_RE_MMAP_SH_PAGE in bnxt_re_mmap(). The driver only ever writes 4 bytes (a u32 AVID) at offset BNXT_RE_AVID_OFFT (0x10) inside bnxt_re_create_ah(); the remaining 4092 bytes of the page are exposed to userspace unsanitised, leaking kernel memory contents. Any user with access to /dev/infiniband/uverbsX on a host with a bnxt_re device (typically rdma group membership) can read this data via a single mmap() at pgoff 0 after IB_USER_VERBS_CMD_GET_CONTEXT. Other shared pages in the same file already use get_zeroed_page() correctly: drivers/infiniband/hw/bnxt_re/ib_verbs.c srq->uctx_srq_page = (void *)get_zeroed_page(GFP_KERNEL); cq->uctx_cq_page = (void *)get_zeroed_page(GFP_KERNEL); uctx->shpg is the only outlier. Bring it in line with the existing convention by switching to get_zeroed_page(). Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Signed-off-by: Lord Ulf Henrik Holmberg Link: https://patch.msgid.link/20260509084011.11971-1-pomzm67@gmail.com Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3876,7 +3876,7 @@ int bnxt_re_alloc_ucontext(struct ib_uco uctx->rdev = rdev; - uctx->shpg = (void *)__get_free_page(GFP_KERNEL); + uctx->shpg = (void *)get_zeroed_page(GFP_KERNEL); if (!uctx->shpg) { rc = -ENOMEM; goto fail;