Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp53897ybl; Thu, 12 Dec 2019 13:57:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxhVxlIhihxrIp2MfzIDD0VRCNMDH8/jdlTcGK6AulRIq2qOyhCKjOF5jEhNC8gWCfJ7nca X-Received: by 2002:a05:6830:10c9:: with SMTP id z9mr10609951oto.200.1576187845844; Thu, 12 Dec 2019 13:57:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576187845; cv=none; d=google.com; s=arc-20160816; b=dRrKiaU2SOmw6uYmzFEXl+AiBayH4BxiGpqWJf4hHpe8XcVbRKy51c/IsNnLj80nYc azRzEOmV86hHtvXMvLXpd2tsm+KPTdkyir3FQaZAFRmU8tX+ZTcsiv4OC5bb3bJkv+rZ tpIT2gur4A+HZi44NL5Itj6y52FBJOXC4pgKMTTm25uF/0yoqkL2XRUKit/woxac3RGL iGsFhZTNd5GMdGiOe+DwMAR+e40NoYTYKblv6pnws8t9rhXu+A71foOwN2rXz02c2V07 oZmcbDCKViyCZClSbTFye6oLN5dayJhKvwFI4zAM8gAJwiKfb0H3QBt2VIs8koJTcHPo WAnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xkjjoJS14Mty7U/oVlaBcEHI4zWeMRudY77r6PRNsWI=; b=Sv0fTBbsimGo8AoWe+B7TxKCwuZJkiPs04msEe01wBwQAbWNMCQ9I4gV95icyTGOtY BXJi02/FD6qt1VwyQYJs8XAwE8A47YlQVNUItalZ261o1ZmDhPayiwbgAMTuyMnzK7gp KLkzRqoBrUrEBy9qw/r7qgDkDo+xA0IwCAcfHJBJzFkOy8xuNbwdGFfSofHdNvrcNbtQ kZPSq6PXc/yWBBiXxlMVF1nIs34AfQtxdvf/9nUyrP7b3mWQt+7H9UUrvsYzOCdui9th MKQSHNlf+ME2aWpOWrITGFnYDVnCY+9ITFHMr7cIgZFtz1GEU/OHBvuTX2KC7emoieqi 1y+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1EBq85mM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si4075851otp.323.2019.12.12.13.57.13; Thu, 12 Dec 2019 13:57:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1EBq85mM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731129AbfLLVn0 (ORCPT + 99 others); Thu, 12 Dec 2019 16:43:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:42248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731086AbfLLVn0 (ORCPT ); Thu, 12 Dec 2019 16:43:26 -0500 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F35E321556 for ; Thu, 12 Dec 2019 21:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576187005; bh=A4nEQkfUDBBVKYKII6PHgh7pFpFt/VN17mv8mSDENJc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=1EBq85mM5JdtXIxar4YW2RpCK6FzQUPLZ9dQDtqe+PA+uS7X91bZB3cUI8va1IMn2 Csjp9s16ki46r9c/5lxwCbqIwGaWiqivusKy+1AmNFZ3ZrbqXz+90XoD3ocqfa2KjB 5SCkAl91jx4avu1VRP0Opv/67Dpkjq8lEl5Z0spk= Received: by mail-wr1-f41.google.com with SMTP id g17so4406688wro.2 for ; Thu, 12 Dec 2019 13:43:24 -0800 (PST) X-Gm-Message-State: APjAAAW6vNcyMaKjyClkvMMLgq0dw0i4vAjrCeUwf+4b6GqI3Zz/U4XK A0f2JsbE88Tg0vQtkvVhGO7uYLq60/VhaKDfGStTjw== X-Received: by 2002:adf:f2c1:: with SMTP id d1mr8464500wrp.111.1576187003430; Thu, 12 Dec 2019 13:43:23 -0800 (PST) MIME-Version: 1.0 References: <08B92B44-CCA9-4B83-B9CC-F1601D44B73F@amacapital.net> <0053f606-f4f7-3951-f40b-b7bd08703590@suse.com> In-Reply-To: <0053f606-f4f7-3951-f40b-b7bd08703590@suse.com> From: Andy Lutomirski Date: Thu, 12 Dec 2019 13:43:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86-64/entry: add instruction suffix to SYSRET To: Jan Beulich Cc: Andy Lutomirski , "the arch/x86 maintainers" , lkml Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 7:40 AM Jan Beulich wrote: > > On 10.12.2019 16:29, Andy Lutomirski wrote: > >> On Dec 10, 2019, at 2:48 AM, Jan Beulich wrote: > >> > >> =EF=BB=BFOmitting suffixes from instructions in AT&T mode is bad pract= ice when > >> operand size cannot be determined by the assembler from register > >> operands, and is likely going to be warned about by upstream gas in th= e > >> future. Add the missing suffix here. > >> > >> Signed-off-by: Jan Beulich > >> > >> --- a/arch/x86/entry/entry_64.S > >> +++ b/arch/x86/entry/entry_64.S > >> @@ -1728,7 +1728,7 @@ END(nmi) > >> SYM_CODE_START(ignore_sysret) > >> UNWIND_HINT_EMPTY > >> mov $-ENOSYS, %eax > >> - sysret > >> + sysretl > > > > Isn=E2=80=99t the default sysretq? sysretl looks more correct, but tha= t suggests > > that your changelog is wrong. > > No, this is different from ret, and more like iret and lret. > > > Is this code even reachable? > > Yes afaict, supported by the comment ahead of the symbol. syscall_init() > puts its address into MSR_CSTAR when !IA32_EMULATION. > What I meant was: can a program actually get itself into 32-bit mode to execute a 32-bit SYSCALL instruction? Anyway, the change itself is Acked-by: Andy Lutomirski But let's please clarify the changelog: ignore_sysret contains an unsuffixed 'sysret' instruction. gas correctly interprets this as sysretl, but leaving it up to gas to guess when there is no register operand that implies a size is bad practice, and upstream gas is likely to warn about this in the future. Use 'sysretl' explicitly. This does not change the assembled output. --Andy