From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id C351A3858CDB for ; Mon, 5 Feb 2024 07:41:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C351A3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C351A3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707118898; cv=none; b=xcDDtnuB5/kWcRMlyH31ap5gM4VfufWllJRyfjaV6BjffCCKwxwqe55ZvWFU5wiQPaPv3l0bSFqZFIY7HfmwJqENj5n9bUK6VcruCPE0SuBl5XO79aTNjKvAT5Qv9YGhQaS0nep9wIO5/rOnvoeyk3aOGLEDQv9133OWub0DFaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707118898; c=relaxed/simple; bh=4bnTT8OmB2/iaGHxvea1xtj+FUe6mdb0XPkbp6UJY/c=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=mOU6ovsNB2J4QzDs2ZpcF6SVPdFyH1dV0S2+71RlnMwlPSOoMtov0JVwP3TgD8skiR+AxkhE+lVAhMHhLTXF7nURSYIPbEWQiZqCa5GIcqpcrlF7VNLxoItrZQGAuawu8eBy0k0nDBErMAIQm0PzBbKWEp0HQrQSSQbRT87uNeE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40fc6343bd2so24209835e9.1 for ; Sun, 04 Feb 2024 23:41:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707118895; x=1707723695; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3S6bidSgZ6wWpXc8h7bG8QCE4abDkbtKs5Dwcpi9lC4=; b=EG8OhBx2KT38S5b2OAO/GqH4nqzoDC1+qH+jqDaP+5T1iaGT5GHDjMpE0xAdBSrTJ/ Lj23T6G5JmAy2VNwtudsP+e6PDDlI7APM2nKznCk7U1is2zx3SOwQya204N+bCB2URUZ WJ7e0EpQp3SsDtQ27x+4o9S6/h8E5+Djye8xr2RGNPkbCwaK10PNnK/R3G/hNwME1bUj eQ2K4/jqpOMLh3pRLhRDH0FlRiDqUHTdt8/Gd57+EJA/Aa86c5if9nhtkDQtLmmFzeMY HLtyMvWM24IYg8tx4sgx0K7hcZnSfb/BQBKsqUQ8INF8RAL/MizzlJYhbZ+92ylK1BpU LCRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707118895; x=1707723695; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3S6bidSgZ6wWpXc8h7bG8QCE4abDkbtKs5Dwcpi9lC4=; b=vDUjnsZPdKWs1tQi7ViSSlzWCeieLWjEjHH7nXkfJeIsDgQLav+M2ywneoWvwm14wu dTuQhjJotYx1AC2I17FltdWqLE9ooR/azSX9rtte4mq/BWiz84Z86MXMSWpY/BIFIIhC 5lIB/pK3thveYBKwSVToBKmWyGIslxbLKW0bKABLrvZZ0XNF8yZtFmxi5GBmUUXbZKcm ktThoxnpP21KR3aWdqzF1yuYaSKiINXZb7JEQvXCeSK+FbsqOHmUdhItt4OlgHj5fZQQ gmFx8OEPEuauPapLmQgKqhcAe8sTOuXUUKX2ZxQnFOzCrMu0zdvVjozlFLySGkGXdnT6 11aQ== X-Gm-Message-State: AOJu0YxnxWauhN9EKLaJ3pRERi3aFSuS80mr/NYycqOpNmyA/3IPos8M fGnMgyWkRYHgAP1p3GgseLyqjBeWa4DRF6//1AUbVMn/KwtLPrQ4s7Q14UnlYQ== X-Google-Smtp-Source: AGHT+IHZTTpu4nBRp35YxiLYJ8Rst8cHv/sFXaSGjGNnsfMXWgsmzUc2w4jAEo3Co9mlkPGDc4XKkA== X-Received: by 2002:adf:f08b:0:b0:33b:1471:1f41 with SMTP id n11-20020adff08b000000b0033b14711f41mr8071125wro.18.1707118895556; Sun, 04 Feb 2024 23:41:35 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCU9CT9Zm2Zdl2NWQSUGpA/PvnqYv/U9O5574KKTcKdHSRyvNV/FSEsBpPGfrXCbsfRED2g1siNL+sIbUY6JTVZvu5590KcB5Q== Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id fc19-20020a05600c525300b0040fbba734f3sm7682356wmb.34.2024.02.04.23.41.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Feb 2024 23:41:35 -0800 (PST) Message-ID: <30194aa4-320b-441a-94ac-419b55544500@suse.com> Date: Mon, 5 Feb 2024 08:41:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] x86: Disallow instructions with length > 15 bytes Content-Language: en-US To: "H.J. Lu" Cc: wwwhhhyyy333@gmail.com, binutils@sourceware.org References: <20240202113310.145132-1-hjl.tools@gmail.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9Jj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0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3025.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 02.02.2024 12:49, H.J. Lu wrote: > On Fri, Feb 2, 2024 at 3:41 AM 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_insn) >>> { >>> j = encoding_length (insn_start_frag, insn_start_off, frag_more (0)); >>> if (j > 15) >>> - as_warn (_("instruction length of %u bytes exceeds the limit 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. - .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. Jan