Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp410139ybz; Wed, 22 Apr 2020 00:15:52 -0700 (PDT) X-Google-Smtp-Source: APiQypKeXruuDSflckmSmb7aGaW8g/2XlZzV3mZS1qI5hu/6gsOTBLxFCEMpTFo6MiuRluL94jW2 X-Received: by 2002:a50:9eaf:: with SMTP id a44mr22828409edf.58.1587539751840; Wed, 22 Apr 2020 00:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587539751; cv=none; d=google.com; s=arc-20160816; b=YIvePJy7iXA7H9kxIaVNOncFvrzRhlFDJgi7S4NpJuc1UO+A0H225JNr+Om7hklVlW mWVEVM3+W100rOr/pZ/Y6B9jlaPspjKTkXUr0/XV9lLL8OVYlDxflu4zM/22Ef3BUiOU ogk+voRZL1nmPmn08yxhpmGAmp58e8LQxZv144CaXIzM37ja58DpYe40m3lRuTHNwxJ/ Sf20dMVqwjO66nElJ+EBv37S5ULZaXwKFlVKagGLTPezBwSQ4UqgngmmguDcyVyxjTk0 rHvMNcGj3KM8D8NV/7l0JHqLny3Yw8l1XQQTW2B82wdCHrz9h2kfcrrJ2Kze42ayJFzs RaeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=lH8gR7qP0904USQOkMbGHlaYsVmsBUEDU6HZANY9l5Q=; b=PFNSTSVH6LxssO9Vwl/BgBvE/pq7TkwpjfUf8wghvaD89jFYF45kTXDNqeE2RKIy9J CG1NH1Grl43GMpM8D59s/4HKbzvPDFlIH7EuhSwfnIXhQsbSnR9bG8tmjhN9b8FY4FV8 0ZI0LyaGLtP/bELAZOH1S7J+2zhRBWVzd0kx93t8x1SBf5VkS51eksAtHfhceWsn28Hu XLOIGMhW0j3+eYn+VDElOmH4GzCONApYr0xGXqFzWAVyNLjKhwC+40OhWmYQ/2IwSQtr 1gvM5kYNSwSihXGE3MGwckX5LdM+eEShTUXUK0Z4KFUT9IQTnj/aMmbA6X+ccMXjoqwp 0p6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020032201 header.b=E6E9K5GN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si3059283edb.250.2020.04.22.00.15.28; Wed, 22 Apr 2020 00:15:51 -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; dkim=fail header.i=@zytor.com header.s=2020032201 header.b=E6E9K5GN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726337AbgDVHOZ (ORCPT + 99 others); Wed, 22 Apr 2020 03:14:25 -0400 Received: from terminus.zytor.com ([198.137.202.136]:53581 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgDVHOZ (ORCPT ); Wed, 22 Apr 2020 03:14:25 -0400 Received: from [IPv6:2601:646:8600:3281:6143:342c:a7b5:2aff] ([IPv6:2601:646:8600:3281:6143:342c:a7b5:2aff]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 03M7DDeA1574159 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 22 Apr 2020 00:13:13 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 03M7DDeA1574159 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020032201; t=1587539595; bh=lH8gR7qP0904USQOkMbGHlaYsVmsBUEDU6HZANY9l5Q=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=E6E9K5GNGb5YxI5PCvOZ+/KVS5+26zVj/lL9RqmhUTHnQUZ70CaW44z6C8uycRn09 zTooMqwQej182vKDbvkfs1MpBRLW3z3aMhFlfU3V40b/JnZu5pEsbkD0IMlJErJtRE HszNcds2h7TV4CRAIjOvYlJzyPdKVQn6sza1s5jUxNXu6jzqN+sr8cF4ssUigAH0Kk 4JdiZM+6gUH+5cRO6TuvASOgWef4OneknTNlvzRGAyjHS4TXd9bIav3JpTCq2dmbtZ gopDzQNo+/fhXzjF5XsJAScgfRo6UUzFKz0xCuLNQnhNjkV9w/jYdkt5lZc5ZiXt4C XMoNzHfAA63wQ== Date: Wed, 22 Apr 2020 00:13:05 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: <20200421171552.28393-1-luke.r.nels@gmail.com> <6f1130b3-eaea-cc5e-716f-5d6be77101b9@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH bpf 1/2] bpf, x32: Fix invalid instruction in BPF_LDX zero-extension To: Xi Wang CC: Luke Nelson , bpf@vger.kernel.org, Luke Nelson , Wang YanQing , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: hpa@zytor.com Message-ID: <05CE7897-C58E-40C0-8E08-C8E948B70286@zytor.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On April 21, 2020 12:26:12 PM PDT, Xi Wang wrote: >On Tue, Apr 21, 2020 at 10:39 AM H=2E Peter Anvin wrote= : >> x32 is not x86-32=2E In Linux we generally call the latter "i386"=2E > >Agreed=2E Most of the previous patches to this file use "x32" and this >one just wanted to be consistent=2E > >> C7 /0 imm32 is a valid instruction on i386=2E However, it is also >> inefficient when the destination is a register, because B8+r imm32 is >> equivalent, and when the value is zero, XOR is indeed more efficient=2E >> >> The real error is using EMIT3() instead of EMIT2_off32(), but XOR is >> more efficient=2E However, let's make the bug statement *correct*, or >it >> is going to confuse the Hades out of people in the future=2E > >I don't see how the bug statement is incorrect, which merely points >out that "C7 C0 0" is an invalid instruction, regardless of whether >the JIT intended to emit C7 /0 imm32, B8+r imm32, 31 /r, 33 /r, or any >other equivalent form=2E C7 C0 0 is *not* an invalid instruction, although it is incomplete=2E It i= s a different, but arguably even more serious, problem=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E