Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1846738lql; Wed, 13 Mar 2024 09:41:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQoIOe8z7V/TBXHznPyDED+11n+r2hKquxpwZTBrntrOnk95IYYqZdDcc30beoYMMP3urzUYOUgpJlnInDCk9cThSIpdPF8q03sqcjWA== X-Google-Smtp-Source: AGHT+IFQ2Zv2t5iPrGwTiUL+stJSOV6Ny92kXAkVZlkuqJsIZ8c/qsS1BPyLXGMimF4kwGCc8uOU X-Received: by 2002:a17:907:d40a:b0:a45:2f1b:c07d with SMTP id vi10-20020a170907d40a00b00a452f1bc07dmr10051462ejc.10.1710348076362; Wed, 13 Mar 2024 09:41:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348076; cv=pass; d=google.com; s=arc-20160816; b=JrYZDFKQ06VuXf1v5P+q0/rlSK/eJEw7km06BdBfRL0PUofdsI3d9uYwNLXiiVpQeb 5NmcfkwlT3pCdiXvLixuNj7nelHTySDzGI0DlVo4z9/IMviBWZ6X6jW64U/G4jCqPSXx 1L5M6op9tF2rEWQM9eoWz2HbIpTQAWg6e3CI38o6MK7kRgBM4TeztllTBkTUlv6RNA4Z BIJCfLRaOwZwMYpdyLSveLh9lnu6edt6TlEw9B2A8Ms/I0os8Dp6zXXgDTCagu/qOlG5 frHFL4dTNoe1DRt43OXx0c1jmlffMcBHbR8ynx6wb/OkhCGTgW5uSV+FhkCJtp1MS6LW AsPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PZ1ONcGbJ6H/eyC5KwwSJ6IHBsFEI2lfFYW9Mn4s8A8=; fh=GEiuxw0Vxgdpy0LuA4ioav0xhGOuD6SBmK+cd6VvlP0=; b=rH1xxqM/y+DFPNnCcMbPWduxTK2xrB0QS6j6lHm3XoDu9mELl5EWTKDqzL2+1MIFNW LtyrEgIMdSpgPMOOzgnGBZ2ctRbwYauQRlxrD6OVwYLt8zq8CX530hQ/IE6l/vXNC6DX GyCfdllgVW+WJVDwbQUvWeSwPAwJTQYVEpj8U7meP8LO8asVhAFSyNrp2v15J8ftIFzt Z3sE27k50xYFcNy5JHjGWiL8RdsP2HtUr2S97mGZevNDcF9nHo6Wng80O8JqRLOxiEh4 uSf/hxglVw4/b3G8+bM5C2oy/9nbJI/v9rtGXrfdDNmExZuwcs1dalDevBkBUQunDCqu g2ZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qc/Gyr1G"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z24-20020a170906669800b00a45ae85e315si4480038ejo.885.2024.03.13.09.41.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:41:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qc/Gyr1G"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 127221F21657 for ; Wed, 13 Mar 2024 16:41:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FC4762161; Wed, 13 Mar 2024 16:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qc/Gyr1G" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5FC5F62140; Wed, 13 Mar 2024 16:33:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347604; cv=none; b=ZopC52ivXnkd+2pzVqpfy5t29vxI3JPHLtx6+AK6YUtaDoZGMaEb8S8ASrTHQMZwYJm5XyQ7G8I/x3Ro8LtzYoIQfw4QWoGeCrx6gWSdmjlyDw9c6S8LC4zhfoXQC6iiSr3QcHbjOySHVR4TDQOav7OHCmVyQ8kXrdKy3DDAkt8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347604; c=relaxed/simple; bh=UY2a1ds5pIif1hu36k0hBJ9Lt+EN8fYHOb1ZFw9/1aY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pI9PAKg3qXgheAugfqvcR2lpcwDvKHPxRW/G7dH/0eDyX+KwWXGei4F3EEOgWgJqokboHbOp4DDThwmHlhs3SAddo3arxqOLACi/VgArp8vjGWoZZiXkLqpbIrP08r8inqVCm+p5haCpMW3WSIodnMpgRZSwehfxAOj/bxD2Vfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qc/Gyr1G; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 665B2C433B1; Wed, 13 Mar 2024 16:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347604; bh=UY2a1ds5pIif1hu36k0hBJ9Lt+EN8fYHOb1ZFw9/1aY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qc/Gyr1G2vtskdFROmUq6JmYxKHz3HzApB5orQJCfDbatrC+Z72hb9EgOW1+4G1Oq TiT1DoFgsXNrJRuiNDn7CsZiz7gVf+pHg0TOrpbSDbzp8J2AjKkH0yXvQ1/wrymAz0 Q5PuBoCcit9TGtoTuBbCdsnB0KQEKma8J/nqyDuOtjGvpJQFrpPqeWozULbCc1wXip 6M0vr1Yxrlw5m3Dtp4+taQ0fW3dYG/XX/h7IFs6t8gB9uR+DPs8vZ2HM1JiKHo2AvC HTTEiBv/RATmN2bkvXSn7b90MyKBHdyVV3Q8tqyNEqNdZHsmEvgkV4UXM3+92hXpJ9 oZdKfFgCtMF3g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , =?UTF-8?q?Tobias=20B=C3=B6hm?= , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.7 37/61] cpumap: Zero-initialise xdp_rxq_info struct before running XDP program Date: Wed, 13 Mar 2024 12:32:12 -0400 Message-ID: <20240313163236.613880-38-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Toke Høiland-Jørgensen [ Upstream commit 2487007aa3b9fafbd2cb14068f49791ce1d7ede5 ] When running an XDP program that is attached to a cpumap entry, we don't initialise the xdp_rxq_info data structure being used in the xdp_buff that backs the XDP program invocation. Tobias noticed that this leads to random values being returned as the xdp_md->rx_queue_index value for XDP programs running in a cpumap. This means we're basically returning the contents of the uninitialised memory, which is bad. Fix this by zero-initialising the rxq data structure before running the XDP program. Fixes: 9216477449f3 ("bpf: cpumap: Add the possibility to attach an eBPF program to cpumap") Reported-by: Tobias Böhm Signed-off-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/r/20240305213132.11955-1-toke@redhat.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index 8a0bb80fe48a3..ef82ffc90cbe9 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -178,7 +178,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, void **frames, int n, struct xdp_cpumap_stats *stats) { - struct xdp_rxq_info rxq; + struct xdp_rxq_info rxq = {}; struct xdp_buff xdp; int i, nframes = 0; -- 2.43.0