From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by sourceware.org (Postfix) with ESMTPS id E057B3858D1E for ; Mon, 5 Feb 2024 15:26:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E057B3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E057B3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707146768; cv=none; b=ols9ZkkLUq9zAZbcbNnjutTfQOWsQ55ydkWpx3eECe+VwFPNiKS1Ikx0qTvOkGysK6P6yu0aeQ2CRpH1r1EknB8OIVVXD8+N/DH/Z8rL+ZfVaUg1c3+3mO1RiSFLMSrGN1xWu+gjxqYsJm4DBKs1uO4NEBMxSNj9docnKz5sXaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707146768; c=relaxed/simple; bh=81OBnv27VyEcTYLIylclOOKlukWveVtIdnmGxF460m8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=BxMR0PKYnRaB0qQsD230UTn++yFxZhCjPlsZj0J4WUyFw1GrzALC3mP8i8p79MVL3EOs7+erJz5Wug+Tu/fomjWROqQM2503rq09+WFI47I1WUWveCTl6jN+XQSnVcEmlbs/iZr7JmPV9o88FX26IakF7JKua6Hlkfo1lG+7Yew= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-59a99ef8c7fso1862796eaf.0 for ; Mon, 05 Feb 2024 07:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707146766; x=1707751566; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WftfKuT5jM99EbR3zChBSGirLJW/rBXSJy8hY2jKWD4=; b=JA4smeFvwIkCGWAoF3CEO1OtVajVL72cl1lz177bAXLuKvR6H+KpnhMj2kWWT0cnYA gyiEGFiVC5BXZ1MfhXTlWZtOiMc0L58wd25vUgCyFBfTlZZ7eJXiJtZkkDIkltXLxV49 2oa8JAC0GC4yWBwiTRaH37T8vjPeCrVQPUW5BXo4mPaXegCrTCNAiZsCsGs/hGiPZbx0 kXfyyF4ak1sdXkpnjBeb8gMPDNvKoGcXeg2/bxyeonEkdXYYFSgAIJ9G+lT9L0oMOx28 70PZw0FI+gB9K4lJDEiLAA2kbcq37bNCkcqoAdygXVPDBQTEzJgx+elQNVzM8zJmQFMJ at7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707146766; x=1707751566; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WftfKuT5jM99EbR3zChBSGirLJW/rBXSJy8hY2jKWD4=; b=a2bF66pHgEogWpWcFF24Of4c4ShoP4FrOSTMmqfF8NZTOdHnMk7AJTmUU0KICFKaY1 sm7D62KqeVimqiOqp5frl07VT7IwLAepmJnvB6l+XsPYcGQwK4+ZmN7l6jXtwU//7+Yh EscDDx+BjWUSJkzfxyAH6xDqy56lJ2hCJmGzw1G8bW6MYeUrEdidyuGwnyKc7/Nd5nK9 GsVluj35DP4ElKcckArxTv1IGY7qRWow/tCrZQHddJdFhoX89zCnxM8uy0FbxH8CjHEl 3ALbaAjfA07lh644BZ1vOk7nm5M3Saq2IY22/ct4ci3AYDjZe+eukpGmidt8pX8AWGe0 U/iA== X-Gm-Message-State: AOJu0YxOVqQbOFsVHssEthFSAiS6c/XI74wjo9IF9CpwjIpRqq614Uv2 ToibFPIk56T5PZfram/Iu8u48+98rRfI1i5DaihIbvIN+mPwKEkeJ7w/V9LrPc9MBe6sfHekbK4 JFZrtaiSKXyLN7Tv3ScbQeJsUiuE= X-Google-Smtp-Source: AGHT+IG6mr82NmnWNp34c6pdvSfCQteUxZ36PLnSwho1poLoQ7uo94z4gpKFCZ5MOSZKlAKGXgslPlyLZaDKpQipIWU= X-Received: by 2002:a05:6359:6488:b0:178:756b:6bcb with SMTP id si8-20020a056359648800b00178756b6bcbmr79118rwb.27.1707146766021; Mon, 05 Feb 2024 07:26:06 -0800 (PST) MIME-Version: 1.0 References: <20240202113310.145132-1-hjl.tools@gmail.com> <30194aa4-320b-441a-94ac-419b55544500@suse.com> In-Reply-To: <30194aa4-320b-441a-94ac-419b55544500@suse.com> From: "H.J. Lu" Date: Mon, 5 Feb 2024 07:25:30 -0800 Message-ID: Subject: Re: [PATCH v2] x86: Disallow instructions with length > 15 bytes To: Jan Beulich Cc: wwwhhhyyy333@gmail.com, binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3014.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Feb 4, 2024 at 11:41=E2=80=AFPM Jan Beulich wro= te: > > On 02.02.2024 12:49, H.J. Lu wrote: > > On Fri, Feb 2, 2024 at 3:41=E2=80=AFAM Jan Beulich = wrote: > >> > >> On 02.02.2024 12:33, H.J. Lu wrote: > >>> --- a/gas/config/tc-i386.c > >>> +++ b/gas/config/tc-i386.c > >>> @@ -11780,8 +11780,8 @@ output_insn (const struct last_insn *last_ins= n) > >>> { > >>> j =3D encoding_length (insn_start_frag, insn_start_off, frag_= more (0)); > >>> if (j > 15) > >>> - as_warn (_("instruction length of %u bytes exceeds the limi= t of 15"), > >>> - j); > >>> + as_bad (_("instruction length of %u bytes exceeds the limit= of 15"), > >>> + j); > >> > >> When taking purely a gas perspective, this may be okay. But I'd like > >> to retain the ability to generate overlong insns (without resorting > >> to .byte), so there wants to be a way to downgrade the error to a > >> warning. This is useful in particular when trying to make testcases > >> for disassemblers or other software decoding insns. > > > > I am checking it in now and backport it to 2.42 branch. We can add > > a switch or a directive later to downgrade error to warning. > > Putting on the branch should be (have been?) deferred until the complete > solution is in place. 2.42.1 could be cut from it at basically any time, > at which point your change would regress the particular case I've been > mentioning. Furthermore I have to raise two more points: > - The 15-byte limit - while long-standing - being rather arbitrary, it > could in principle be changed (bumped) at any time (as indicated, I > think the latest with APX it should be bumped). Whenever such a bump > occurs, the assembler outright refusing to assemble respective insns > will be a problem. 15 bytes is a hard limit, which also applies to APX. When the size limit is increased for a new ISA in the future, we will allow the bigger size only for the specific ISA. > - .insn is particularly intended to permit encoding things the assembler > may not otherwise be able to encode. Therefore the diagnostic there > ought to be more relaxed than for "ordinary" insns. > I will see what I can do about it. --=20 H.J.