From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by sourceware.org (Postfix) with ESMTPS id DEA21386EC42 for ; Fri, 24 Apr 2020 13:00:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DEA21386EC42 Received: by mail-il1-x143.google.com with SMTP id f82so9125740ilh.8 for ; Fri, 24 Apr 2020 06:00:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MOMZE8iH78shuhYGmHoMDtfA++8uhIsWZgBiqcmnEYA=; b=lfIlTAfVhLgto7wqn682MXkLAklOcTLZLCxnXAO7LAHOZOrC6H5hNnDJsbRqJDZ8tv KbayvZben1d2rZsbEu1yxZ8G4xmHWnujJNpN10nmGguarHVP8muSrJpfQTsuteLFQ63o ssCyWoJHT7NFF1qt48OLBBqwrVKrv7CfeG1/FLEgSSBivW+Cv6nGgnyocl2oomKyvmBl pDm8bMaGpKYTm0CXuijPiQOABttJqBJBjLXPqIQ7D5FCUs/OeIr/AF1WfQldGGbYZ6jM qA4xT7O75vPB0B2+bNTOO44VHinO46Drf5EZwvQdHq/HpyILvwYurAHGaGZyAv4nXhn4 u3xg== X-Gm-Message-State: AGi0PuaWBUfNTu2ppjpMnoS9f3wqJk93ArFW1Ggus/yHL+dB7VBXW1Uv 2dvMOInmpfKsQ3/zZ5TGmSsofppz299mg/yya9aayQ== X-Google-Smtp-Source: APiQypJyF1Ipd/NhZHRvfMrlvsOB1I0/2EEXA3XmUk9lwKNSU9xjkBm5BK/pC8GyFoJCv0BwPwCklMnbwY0m6qQkJ2o= X-Received: by 2002:a92:c150:: with SMTP id b16mr8857790ilh.13.1587733240432; Fri, 24 Apr 2020 06:00:40 -0700 (PDT) MIME-Version: 1.0 References: <20200310160528.303613-1-hjl.tools@gmail.com> <70acc1ec-ce95-9df7-cdce-1d6c2305b1b4@suse.com> <7a1737f4-2371-e1c2-e1ce-1c35a76292a2@suse.com> <3c0f0998-23f8-12ad-f095-27d4f7173b16@suse.com> <70ee5f7f-a0a8-747a-a674-81424d8fc443@suse.com> <878893bb-3eca-7f7c-5662-ee8d753a3f39@suse.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 24 Apr 2020 06:00:04 -0700 Message-ID: Subject: Re: [PATCH 1/2] i386: Generate lfence with load/indirect branch/ret [CVE-2020-0551] To: Hongtao Liu Cc: Jan Beulich , Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.5 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2020 13:00:42 -0000 On Fri, Apr 24, 2020 at 12:24 AM Hongtao Liu wrote: > > On Fri, Apr 24, 2020 at 2:01 PM Jan Beulich wrote: > > > > On 24.04.2020 07:30, Hongtao Liu wrote: > > > Change to > > > > > > + /* lret or iret. */ > > > + bfd_boolean lret = (i.tm.base_opcode | 0x5) == 0xcf; > > > + bfd_boolean has_rexw = i.prefix[REX_PREFIX] & REX_W; > > > + char prefix = 0x0; > > > + /* Default operand size for far return is 32 bits, > > > + 64 bits for near return. */ > > > + /* Near ret ingore operand size override under CPU64. */ > > > + if ((!lret && flag_code == CODE_64BIT) || has_rexw) > > > + prefix = 0x48; > > > else > > > + prefix = i.prefix[DATA_PREFIX] ? 0x66 : 0x0; > > > > One minor remark on this one - I'd suggest to either omit the > > initializer for prefix, or make the last two lines > > > > else if (i.prefix[DATA_PREFIX]) > > prefix = 0x66; > > > > as there's no point assigning 0 twice. > > > > I'll do this change. > > > > Update total patch: > > > > Looks okay to me now, thanks. > > > > Jan > > Thanks for you review and patience, I'll wait for H.J's approval and > submit my patch. > Please post your final patch. Thanks. -- H.J.