From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by sourceware.org (Postfix) with ESMTPS id F07503858403 for ; Fri, 2 Feb 2024 11:36:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F07503858403 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 F07503858403 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b2f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706873801; cv=none; b=YXwoXdR7T2+XKRdYCQhX1zH7ErMXaaeOaaOrO6C92SDuY6x6SPfKTur0xS/08q2q2YuJfeCHU/sGZdlG5UtU1d4SGq2XBLI+Z9+RaEZ1w+2EvoC4J1kfUOC9TDjwy9csVqlhuhmwQC4LcwVQfNFNAJ4sTo4hpdBBi/pV3svBAwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706873801; c=relaxed/simple; bh=cAIqxtVaT5zuHpt6ZOc6YTdeIzpgdZF3DHw3TgnJ3F4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=lVf5w2EUZt0M2fyxdUzWS0DpxuKZ7dwfUhvyL2R+TcN5m+fgJCH3jbgJ0qdMvrNyFheAtq+SkNbCzGOQUy4iLfkCzaoNcR4EbIjaEKTHkdtTyl0SKZIvXHp8dNDQsj2ka5G7lYCjgFZF+oay0ZSi3AAd9HJUgSznAQVvmr9P+24= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-dc238cb1b17so1817444276.0 for ; Fri, 02 Feb 2024 03:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706873799; x=1707478599; 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=AR7B0uLNHyn+ioNzvW/wBVi7hNiOF5oaQF1nkVqvMP8=; b=QYzacZiGFKf7EuPiHP3vKUOVUMPor87CdpaVHDXHsLAZmpErnHxGHD+qdX4ugKVIV3 lFM3uqhmZ7bdSGJnq2IJRiwFmhjL4nyNmEp0/j3yG+EwoyM1SmqVheFiVzF2lrDvStJS bZDYfr9tVkhF26ZAIFrpL8OEqc+FgwGTAXKrLHPL+/NTf2tB608ONyXIqZsfNnnf9vQ3 D1ctzLXT7S+ESS/7FrjU4+Zzg+dLCeTRBktXuCpaHwc6lZ1v/oz2nDjqUJp0x/p4BOuN QLotf5U3FB+JTyDQrrazD+V5Ykz3DyYddYyA6bOktcWr5pYn2s1FLjZPt1Tj9lrEZnmF rjjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706873799; x=1707478599; 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=AR7B0uLNHyn+ioNzvW/wBVi7hNiOF5oaQF1nkVqvMP8=; b=us1vvLxDlXyo1WnzRwfnx621uxZMsNX+3+CKrJeSmTdqJWe9iZeXkC2b1ieRBrYLCy E202BFModxVH8Xrl0eYLBixCun/8rEUD40smmNkaNarjZpjjj8ayq/2T9CnJStbXVnyf gVjjez30XUJnwI4LvEa9TucJyOTINLOivPn3jKf8Gw2JeUWAPmhdTyxfhFjqsK2PzeQt oV1Wyrf53nh2bG17EBxF+pcJjjXB+aJaIK+umBzOXgpbSG/NvGV6VF6ZI4xwqBoQnogm Pc3uVy5VNikUFcOq26Bhn0g5qfIDIw2vO39ndUnh+HPAyzoexccR03827zAHMFr9Vu7N 7czA== X-Gm-Message-State: AOJu0YwnTUFKfaOcLa3StrhznajCcMj3Q5OH6HBRPxgm9pFr/OKfJQVE qQRlwf+rj7vzxWtv7/SW6s3ZODTRE6yUSXdb2Rfma8duP64zKr/lmpfiWBUagTacp25BZBCcJyl nbOcKbTr7bC0PJbEFQQU8333qd7A= X-Google-Smtp-Source: AGHT+IFleXwp112lrZMY8VHSYNU0IvE6GbeVxKaM2oTo2pzE78cS7DKm2k2YOiMDqpoQuyMglC9vTPLg9oDaKQcjzEI= X-Received: by 2002:a25:8708:0:b0:dc6:a78e:d20a with SMTP id a8-20020a258708000000b00dc6a78ed20amr1786997ybl.35.1706873799235; Fri, 02 Feb 2024 03:36:39 -0800 (PST) MIME-Version: 1.0 References: <20240201224749.214439-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 2 Feb 2024 03:36:03 -0800 Message-ID: Subject: Re: [PATCH] x86: Disallow APX instruction 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.7 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 Thu, Feb 1, 2024 at 11:23=E2=80=AFPM Jan Beulich wro= te: > > On 01.02.2024 23:47, H.J. Lu wrote: > > --- a/gas/config/tc-i386.c > > +++ b/gas/config/tc-i386.c > > @@ -11772,8 +11772,14 @@ output_insn (const struct last_insn *last_insn= ) > > { > > j =3D encoding_length (insn_start_frag, insn_start_off, frag_mo= re (0)); > > if (j > 15) > > - as_warn (_("instruction length of %u bytes exceeds the limit = of 15"), > > - j); > > + { > > + if (i.tm.cpu.bitfield.cpuapx_f) > > + as_bad (_("instruction length of %u bytes exceeds the lim= it of 15"), > > + j); > > + else > > + as_warn (_("instruction length of %u bytes exceeds the li= mit of 15"), > > + j); > > + } > > Why would APX insns be different from others? IOW I continue to think tha= t No. It is just very easy to generate invalid instructions with APX. > having a warning here is good enough, uniformly. And it's quite sad that We ran into this with real codes and triggered run-time errors. > with introducing APX the limit isn't raised, to accommodate all valid ins= n > forms (not considering ones with redundant prefixes, of course). _That_ > would then permit special casing APX here, in _not_ warning anymore. > Here is the v2 patch: https://sourceware.org/pipermail/binutils/2024-February/132285.html to change warning to error for all instructions. --=20 H.J.