Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1592258imw; Sat, 16 Jul 2022 10:00:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vvodh1n/uTe/l8JxoLFvrNjt9jfHCWxN7jkEkdWRHf7K1p5gyoEb2tZtc28e+5SFaGkxvI X-Received: by 2002:a17:907:608f:b0:72b:7db9:4dc6 with SMTP id ht15-20020a170907608f00b0072b7db94dc6mr18318321ejc.463.1657990835926; Sat, 16 Jul 2022 10:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990835; cv=none; d=google.com; s=arc-20160816; b=N5EguwYLo+AteJVgglDkiWFMHrtyE44lveuz7DhrADvugIAy8EBAvGi8Cyqyod/lWU BgfR6/oUraCa3rXKzFWONbgHXSdf3+Euyji6EpB4fffmyO2IY925bqObDjuUVMRMcV46 lcmeVxKGfvKOTmPOj0SoUttmAdRiGDoXXlTJjcLqE4SX92AdoO9GOMacnYkwmflfSDnM QxzZt/zSxjX6kd7OtptNxnJjRjSNta7lrCrc/wbd/hO0Zobi5b2m6gUKQaO4ZkrVlzS1 i7x0VKUfwSxhkBby7k48SUV426mVsygk3rDfPXBDRA5fKACcusPd53tlh+2EEU8uNzJg Zl+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature:dkim-signature; bh=ou8Rl3rKdNin3iFI14DAAcINBGak3oEAgpZ2DwPHU24=; b=1HWngtD9MMOInrX/Rd98j/H2wvUoyUcgZ/rG/ctEfz5uNiUCtZLT/APXJXm1LC9UbA CMvhiuu2cyeJTsylbmnBcHM60QLf8BHFRj5L0J++7X/+yq7EAJ3T7evgYygE92SZW3O9 iQ8qLbnCHY/VTBYLj4hH9KY1g1AIJUpuSop7KgyuvhbF5gqgSbwPAbRhsylF1//4Ys9s P6R6n6uNrvfhUIQrEU9dI/XlKvoDGzkogY1TPn1qk/JD5GePOzk8w9axiQE0i1Ut/eWq VqYlWp0fSgyO9TW6wBM7BlRCaXoRpI9kPHTX7mdPoCnDLf10etFB/jhOtw0V8GAhuYlp dnSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=h2RyGvFZ; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a056402440e00b004371d8cbb34si11588298eda.292.2022.07.16.09.59.41; Sat, 16 Jul 2022 10:00:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=h2RyGvFZ; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbiGPQff (ORCPT + 99 others); Sat, 16 Jul 2022 12:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbiGPQfe (ORCPT ); Sat, 16 Jul 2022 12:35:34 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684691EC7B for ; Sat, 16 Jul 2022 09:35:32 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F0837202E4; Sat, 16 Jul 2022 16:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657989330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ou8Rl3rKdNin3iFI14DAAcINBGak3oEAgpZ2DwPHU24=; b=h2RyGvFZRNu1j239mKDyQg+j7qJ/jd7VwXWZgEFZyK9SHH3Yg7cTBC0MhwLFrfkg0Bg/XK kOUrPpE5EcgMxvhAw9n5jZpoPuN2+Z0d28R0eyGtXst7y/YUwJNZgB59kz5W2MRSsGhzJW zdtef5jJRiqQ058zvI09cl6+/wJcl3I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657989330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ou8Rl3rKdNin3iFI14DAAcINBGak3oEAgpZ2DwPHU24=; b=h3HhjFZuj75cKW79F2SYwnpVgjphh1wfpkaUmhihoh9HRjQTIpvR2xUEozkj3RjoNPESIQ H1hifNVornz8VhDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 94E591351D; Sat, 16 Jul 2022 16:35:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YKsHI9Lo0mIjBgAAMHmgww (envelope-from ); Sat, 16 Jul 2022 16:35:30 +0000 From: Nicolai Stange To: Greg KH Cc: Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, Ben Hutchings Subject: Re: Build warnings in Xen 5.15.y and 5.10.y with retbleed backports References: <1b8fee7f-5af2-332e-d2c9-ceecd6ff487b@oracle.com> Date: Sat, 16 Jul 2022 18:35:29 +0200 In-Reply-To: <1b8fee7f-5af2-332e-d2c9-ceecd6ff487b@oracle.com> (Boris Ostrovsky's message of "Tue, 12 Jul 2022 16:22:41 -0400") Message-ID: <875yjxrp66.fsf@linux.fritz.box> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I see a patch for this has been queued up for 5.10 already ([1]), I'm just sharing my findings in support of this patch here -- it doesn't merely exchange one warning for another, but fixes a real issue and should perhaps get applied to other stable branches as well. TL;DR: for this particular warning, objtool would exit early and fail to create any .orc_unwind* ELF sections for head_64.o, which are consumed by the ORC unwinder at runtime. Boris Ostrovsky writes: > On 7/12/22 3:31 PM, Greg KH wrote: >> On Tue, Jul 12, 2022 at 03:19:39PM -0400, Boris Ostrovsky wrote: >>> >>> On 7/12/22 12:38 PM, Greg KH wrote: >>>> Hi all, >>>> >>>> I'm seeing the following build warning: >>>> arch/x86/kernel/head_64.o: warning: objtool: xen_hypercall_mmu_update= (): can't find starting instruction >>>> in the 5.15.y and 5.10.y retbleed backports. The reason for this is that with RET being multibyte, it can cross those "xen_hypecall_*" symbol boundaries, because ... >>>> >>>> I don't know why just this one hypercall is being called out by objtoo= l, >>>> and this warning isn't in 5.18 and Linus's tree due to I think commit >>>> 5b2fc51576ef ("x86/ibt,xen: Sprinkle the ENDBR") being there. >>>> >>>> But, is this a ret call that we "forgot" here? It's a "real" ret in >>>> Linus's branch: >>>> >>>> .pushsection .noinstr.text, "ax" >>>> .balign PAGE_SIZE >>>> SYM_CODE_START(hypercall_page) >>>> .rept (PAGE_SIZE / 32) >>>> UNWIND_HINT_FUNC >>>> ANNOTATE_NOENDBR >>>> ANNOTATE_UNRET_SAFE >>>> ret >>>> /* >>>> * Xen will write the hypercall page, and sort out ENDBR. >>>> */ >>>> .skip 31, 0xcc >>>> .endr >>>> >>>> while 5.15.y and older has: >>>> .pushsection .text >>>> .balign PAGE_SIZE >>>> SYM_CODE_START(hypercall_page) >>>> .rept (PAGE_SIZE / 32) >>>> UNWIND_HINT_FUNC >>>> .skip 31, 0x90 ... the "31" is no longer correct, ... >>>> ANNOTATE_UNRET_SAFE >>>> RET ... as with RET occupying more than one byte, the resulting hypercall entry's total size won't add up to 32 anymore. Note that those xen_hypercall_* symbols' values are getting statically calculated as 'hypercall page + n * 32' in the HYPERCALL() #define from xen-head.S. So there's a mismatch and with RET =3D=3D 'ret; int3', the resulting .text effectively becomes 101e: 90 nop 101f: c3 ret=20=20=20=20 0000000000001020 : 1020: cc int3=20=20=20 1021: 90 nop 1022: 90 nop This is probably already not what has been intended, but because 'ret' and 'int3' both are single-byte encoded, objtool would still be able to find at least some "starting instruction" at this point. But with RET =3D=3D 'jmp __x86_return_thunk', it becomes 101e: 90 nop 101f: e9 .byte 0xe9 0000000000001020 : 1020: 00 00 add %al,(%rax) 1022: 00 00 add %al,(%rax) 1024: 90 nop Here the 'e9 00 00 00 00' jmp crosses the symbol boundary and objtool errors out. >>>> .endr >>>> >>>> So should the "ret" remain or be turned into "RET" in mainline right >>>> now? >>> >>> >>> It doesn't matter --- this is overwritten by the hypervisor during >>> initialization when Xen fills in actual hypercall code. It does makes a difference though: even though objtool reports only a warning, it still exits early in this particular case and won't create any of the .orc_unwind* or .return_sites sections for head_64.o as it's supposed to. The significance of not having .orc_unwind* for head_64.o is that the reliable stacktracing implementation would mark the swapper tasks' stacktraces as unreliable at runtime, because the ORC unwinder would fail to recognize their final secondary_startup_64() from head_64.o as being the end. Note that livepatching relies on reliable stacktraces when transitioning tasks. >>> >>> >>> So f4b4bc10b0b85ec66f1a9bf5dddf475e6695b6d2 added 'ret' to make objtool= happy and then 14b476e07fab6 replaced 'ret' with RET as part of SLS fixes.= The latter was not really necessary but harmless. >>> >>> >>> So it can be 'ret', RET, or anything else that tools don't complain abo= ut. It will not be executed. >> Cool, thanks. >> But what about the objtool warning that I now see? Is that "real"? > > > > It's not real in the sense that the code there is not real, it will be ov= erwritten. (Originally the whole page was 'nop's) > > > I am getting a different error BTW: > > arch/x86/kernel/head_64.o: warning: objtool: .text+0x5: unreachable inst= ruction > I think this one is (mostly?) harmless, at least as as far as the .orc_unwind* generation is concerned. Josh would know more. Thanks, Nicolai [1] https://lore.kernel.org/r/Ys+8ZYxkDmSCcDWv@kroah.com > > >> I don't run any Xen systems, so I can't test any of this myself. > > > You can't test any changes to that code --- it is rewritten when Xen gues= t is running. > > > We probably do want to shut up objtool. Josh, any suggestions? > > > -boris > --=20 SUSE Software Solutions Germany GmbH, Frankenstra=C3=9Fe 146, 90461 N=C3=BC= rnberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG N=C3=BCrnberg)