Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4491459pxb; Tue, 31 Aug 2021 06:33:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe+IpivlK7jYvGeyr9F2lk1e+mscDfLJ4Vrnu/5Tr0bg1wYm0Q21qavN5d/XkrCglSuuOp X-Received: by 2002:a92:d586:: with SMTP id a6mr19909233iln.283.1630416833473; Tue, 31 Aug 2021 06:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630416833; cv=none; d=google.com; s=arc-20160816; b=khm7BizPN/RBEOWbEVa5eAHGbGlxag8f5S5FiJiYBeXU4aCyVdIEaiykO1KeT8h+3B wZKBcrrk1680j1lLipGvGmJt7PK0a09h7vdSDbb+KXe1p8F7fVul7uurehF2A32Ajf8r DnT66dXPFK5NzIKodvaMCr8xnlnizk4rmue3SriKyiLRzurbHkjkXfr7jrbbfBbMTdlQ sHSuyIZnblJF3xwUl1hFXaL2Z1/31nxDjE1oupGRGWgJmgKB4jGuXeL4U0Z6lFgPj88g 568wr+YPbJKSPcqy2RAQGne3E3ET1OF+GKmwp1IR+o4i/4YMdga/wnVTo6ETPTwJGLME s49Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=9PjzhH4UrPlPfUrWCLaesxcO2WcZzNa3pvE4b32hwps=; b=NtJ0JnyXzcUj4GYK2bay5Ov0D7HkgNrqgl+d4AhvFN/d079W6goCD5/g5L9t5rB/Y1 KcJ4AXAO+3R3mHdVl6MEC1Rb4Sr3fOLQXjobNsq5RyOKd9K8rqY0KoIXtMXqBjlRQxTa RvVAVJfdQr9nh/LeaV25UGIsFv/rq0UbWQBNjWBtiWF8VRrMu3cwndfeIn3u6UAu5joX WVOTpbnOhlBxWWfzeITIXU0hvBu7dyS8aOQ3TpAEepdpnEUChAFl3DWGt03U3vjH5/7t 2kJfE1GTb0KdV+MGbXQ0km6HfGGsuhOAPUjvSiuSSJM6J95si4ZL5SIVNlXYdI8n6B1+ fJGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si18325841ios.58.2021.08.31.06.33.37; Tue, 31 Aug 2021 06:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234150AbhHaNbw (ORCPT + 99 others); Tue, 31 Aug 2021 09:31:52 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:39428 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233251AbhHaNbu (ORCPT ); Tue, 31 Aug 2021 09:31:50 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7F8DA1C0B79; Tue, 31 Aug 2021 15:30:53 +0200 (CEST) Date: Tue, 31 Aug 2021 15:30:53 +0200 From: Pavel Machek To: Thadeu Lima de Souza Cascardo Cc: Pavel Machek , stable@vger.kernel.org, kernel list , daniel@iogearbox.net, john.fastabend@gmail.com, ast@kernel.org Subject: Re: CVE-2021-3600 aka bpf: Fix 32 bit src register truncation on div/mod Message-ID: <20210831133053.GA32426@duo.ucw.cz> References: <20210826102337.GA7362@duo.ucw.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XsQoSWH+UP9D9v3l" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > So this explains "mov32 w0, w0" is problematic, and fixes the bug by > > replacing it with jmp32. Unfortunately, I can't do that in 4.19; plus > > I don't really see how the bug is solved -- we avoided adding mov32 > > sequence that triggers the problem, but the problematic sequence could > > still be produced by the userspace, no? > >=20 > > Does adjust_scalar_min_max_vals still need fixing? > >=20 > > Do you have any hints how to solve this in 4.19? > I have just sent the fixes for 4.14. I sent fixes for 4.19 last Friday. >=20 > The problem here is that the verifier assumes the source register has a g= iven > value, but the fixups change that value to something else when it is trun= cated. >=20 > The fixups run after the verifier, so a similar sequence produced by user= space > will be correctly verified, so no fixes are necessary on adjust_scalar_mi= n_max > for this specific issue. The fixed-up code is not verified again. Thanks, understood. > The challenge in providing those fixes to 4.14 and 4.19 is the absence of= JMP32 > in those kernels. So, AX was taken as a temporary, so it would still work= on > JITs. Yes, I got that far. I have seen the patches for 4.19 and 4.14, and they should fix my problems. Thanks a lot for them. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --XsQoSWH+UP9D9v3l Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYS4vDQAKCRAw5/Bqldv6 8qDgAJ0bm7OWm/wylXX8uShwf5qRCpRJHwCfaIxAey3KNwcbTgwPdbp8O7vts3Y= =lf2P -----END PGP SIGNATURE----- --XsQoSWH+UP9D9v3l--