Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp878334imw; Wed, 13 Jul 2022 09:33:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sm6ez7gha4poFgyZGX0g226GXDZohxDrXsVdJN0IYs1HhEC8JxUCJcAiiQRIufy1Zy2IVf X-Received: by 2002:a17:906:84f0:b0:72b:72b6:c7b2 with SMTP id zp16-20020a17090684f000b0072b72b6c7b2mr4410386ejb.642.1657730023528; Wed, 13 Jul 2022 09:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657730023; cv=none; d=google.com; s=arc-20160816; b=u302BkwpeHVPFAS+Fw7aZLD39ifHmWQOkvR6kVAh2ab9BMvJRmXlGlSjHqaV+NXxbW NYqDwSvlzPmhCLpAp8J2JSbNdQMDXqYnsJgaEjUzC7MuvptgkgQB2SNhN264xMHk+3JA TJzsn9eRi2nzVEjQp/wSIVRv/kbU1Rprne/PM9FvFITqXHjcyWUEO/pS4CJzdGdtErxF sFPhFNo9p9AwJ/bywDxYOVdZNJ9vg0JMQphuZRPES0piwnXhS0RBH106dQEpwJxzsNre pbLrwKgazPbKb9ylX28sJCRpng6qDfWWvBB3Def3UCaoDq0LJs9DUT4QJxWIzIjkC/wL iTBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=832nvkZXqaW1Rdvm3esdQt5krPHyQbIa8+WuQyv+HXM=; b=hsoHFhgdvSoqWzAlSAahWkuQ2TQ+an3rtuEQ58z1tX/VS3UNuZSPL4WfhCYPi/5RX8 tBPE2OmU709KKtbrvEBDUp8sSQuuP/9xbTAAVrIJcj6BdG/jGO6hyCMFFw+YDR7JN/ku TFztIbi8gbExIjN1JPu6C7SLAOJfuF8UzRjJHMyyzCaFX9IVYq11aSjFOiCdcR5lp+On WLdHpVSN7tulpwi07Gv2yEWHVr+WvRbuX8eQRN8GlFFm4sxjv2oX/yn5auKnoyJfiz+s fPLjDuk8lRzuaG6ZqqzdP8dX+Z1G2F5vcIHwaDSqGRyJPuAVnPcYmSVpVzPSKVQXa58y pCcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=dph457u6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id zh2-20020a170906880200b00722dcffcce0si16550374ejb.434.2022.07.13.09.33.18; Wed, 13 Jul 2022 09:33:43 -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=@infradead.org header.s=casper.20170209 header.b=dph457u6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237187AbiGMQZ4 (ORCPT + 99 others); Wed, 13 Jul 2022 12:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237176AbiGMQZt (ORCPT ); Wed, 13 Jul 2022 12:25:49 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F10CD2DE9 for ; Wed, 13 Jul 2022 09:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=832nvkZXqaW1Rdvm3esdQt5krPHyQbIa8+WuQyv+HXM=; b=dph457u6XiKxidXKO4sosmAwGu xPbibBbBM32DDiTYhs2OoY3zXXQPjdF9K6VsNUkq0Htv48uhqv9cZ8QQUGrex+vRrcTJfcl2YxNsM PHcq3fRdG22401ROx3f9N4yPVz/h2tW+uuQyU3nqaeh9UBiL3jxDvt6MxpAR2WqM921kT9adnjvYw tfFGPWo8D4PM8zZwbQM+BM0CfXMaSSeabOAMVgGh2KQtRLgt85oGDDgQrw7M+GubmMDtU7+0SRIKC 3kFApEdn7uproQKEn0RBpUN/65qsg/DtI+jNCyxXOxkjTS6VjlVD9IFyMZPnr/n6Gn4lZMX0gQrXV t2OpBEng==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBfBG-008OTG-9T; Wed, 13 Jul 2022 16:25:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E40E930041D; Wed, 13 Jul 2022 18:25:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CDF2220D74F04; Wed, 13 Jul 2022 18:25:41 +0200 (CEST) Date: Wed, 13 Jul 2022 18:25:41 +0200 From: Peter Zijlstra To: Nathan Chancellor Cc: Nick Desaulniers , Josh Poimboeuf , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: objtool "'naked' return found in RETHUNK build" with clang + CONFIG_K{A,C}SAN=y Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2022 at 09:13:29AM -0700, Nathan Chancellor wrote: > On Wed, Jul 13, 2022 at 09:01:58AM -0700, Nick Desaulniers wrote: > > On Wed, Jul 13, 2022 at 8:48 AM Nathan Chancellor wrote: > > > > > > Hi Josh and Peter, > > > > > > After commit 9bb2ec608a20 ("objtool: Update Retpoline validation") and > > > commit f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs"), I > > > see a spew of objtool warnings when building certain configurations with > > > clang. Examples below, they appear to trigger in every single file. > > > > > > With x86_64_defconfig + CONFIG_KASAN=y: > > > > > > arch/x86/ia32/audit.o: warning: objtool: asan.module_ctor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/ia32/audit.o: warning: objtool: asan.module_dtor+0x11: 'naked' return found in RETHUNK build > > > init/version.o: warning: objtool: asan.module_ctor+0x11: 'naked' return found in RETHUNK build > > > init/version.o: warning: objtool: asan.module_dtor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/kernel/cpu/rdrand.o: warning: objtool: asan.module_ctor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/kernel/cpu/rdrand.o: warning: objtool: asan.module_dtor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/kernel/fpu/bugs.o: warning: objtool: asan.module_ctor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/kernel/fpu/bugs.o: warning: objtool: asan.module_dtor+0x11: 'naked' return found in RETHUNK build > > > arch/x86/kernel/platform-quirks.o: warning: objtool: asan.module_ctor+0x0: 'naked' return found in RETHUNK build > > > init/calibrate.o: warning: objtool: asan.module_ctor+0x11: 'naked' return found in RETHUNK build > > > init/calibrate.o: warning: objtool: asan.module_dtor+0x11: 'naked' return found in RETHUNK build > > > > > > With x86_64_defconfig + CONFIG_KCSAN=y: > > > > > > arch/x86/ia32/audit.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > init/calibrate.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > init/version.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > arch/x86/kernel/fpu/bugs.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > arch/x86/kernel/cpu/rdrand.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > arch/x86/events/probe.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > arch/x86/kernel/apic/ipi.o: warning: objtool: tsan.module_ctor+0x5: 'naked' return found in RETHUNK build > > > > Thanks for the report. I wonder if this might be a compiler bug; it > > seems like the {a|t}san.module_{c|d}tor functions are being emitted > > with ret instructions? > > > > If you have one of these builds lying around still, can you provide: > > > > $ llvm-objdump -dr --disassemble-symbols=tsan.module_ctor > > arch/x86/kernel/fpu/bugs.o > > Sure thing. > > With KASAN: > > $ llvm-objdump -r --disassemble-symbols=asan.module_ctor,asan.module_dtor build/arch/x86/kernel/fpu/bugs.o > > build/arch/x86/kernel/fpu/bugs.o: file format elf64-x86-64 > > Disassembly of section .text.asan.module_ctor: > > 0000000000000000 : > 0: be 01 00 00 00 movl $1, %esi > 5: 48 c7 c7 00 00 00 00 movq $0, %rdi > 0000000000000008: R_X86_64_32S .data > c: e8 00 00 00 00 callq 0x11 > 000000000000000d: R_X86_64_PLT32 __asan_register_globals-0x4 > 11: c3 retq As Nick said; this should be: 'jmp __x86_return_thunk', on those builds.