Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp15843imw; Wed, 13 Jul 2022 18:04:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uodxi8x9I6dtTNmLakfqixnR1E17O69Uxf1qFKnqhy4DYat3z+5qSkfIp1x7vRfewPu8WY X-Received: by 2002:a17:907:a427:b0:72b:8cc5:5487 with SMTP id sg39-20020a170907a42700b0072b8cc55487mr6101429ejc.354.1657760661224; Wed, 13 Jul 2022 18:04:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657760661; cv=none; d=google.com; s=arc-20160816; b=ejmy8lQQLTHCJKKDMR/0jMhGYzT+iePbBVV891lda/SZNBiCNQ3T++nq0Z8cSsnUDe jlXJrmugcvZ+WdjTdtJ+21k7nP+nYYQiymVpH3chbCHFax2hTdzEE5wQhV4t253SblNy DzDjsfgj0UBfQK9vrY1xiG8ln/0fb8ndFi+9+xg4JgWr+082BMtPhx7Sv4NUD39PFuMj pB3OV9QqNquoDzsz2r0brOf3QOyzt1yjCfnWruQDlwGKjTHtgR9faoBSxhxSUs6dqiul 2nEDCel1suZ8pDMyFWlu6o6a1IelqSb6Mdy5t+bGXDxNyWKJlYraZzklxrl/Fw0+nv0B ywJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cCDk/erGUZ/u3ecrMonx4NhH5B0mUzK61fX+A9ryTCk=; b=RFBIWQPw/l8amUNEjlsjyH+WVYQrRUHg7k9S6bFv6Ur26sIuHdEnqJM+nRaV18K9Cg uKYMeJvd4EZakQd8E5dikRWTYMu5AelIZpuT1RUXD0nKUadZDOnVSUxjmbA8HZvgOfZS v6SX9kOGr+Je6BL/MKArDyU2gsvio9FNMoMVXaJkc0jaUjZxFXm1jITJKtK5U7RUrsX1 mClJfLR2XSzq/k8bEXQxpIXW9ZTA+orF9Jwbxjh4tEXtR86LOY6kwt+Yl3VzaLOwtgof qBXxx1Z6CDfnUZvHyf1CziGcHEG5JQav8kgymSNcCEpgJms9h7jEDy+VFMEmYKeDeSH7 dNYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Yk0JHxCm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb29-20020a1709076d9d00b0072c780c672csi241345ejc.671.2022.07.13.18.03.54; Wed, 13 Jul 2022 18:04:21 -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=@google.com header.s=20210112 header.b=Yk0JHxCm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbiGNAcQ (ORCPT + 99 others); Wed, 13 Jul 2022 20:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbiGNAcM (ORCPT ); Wed, 13 Jul 2022 20:32:12 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F4F2724 for ; Wed, 13 Jul 2022 17:32:10 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id c15so387504ljr.0 for ; Wed, 13 Jul 2022 17:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cCDk/erGUZ/u3ecrMonx4NhH5B0mUzK61fX+A9ryTCk=; b=Yk0JHxCmlrIooUUNTioP/fV2MZjZ78FuerkvUww0uexloG8rEew+YxALiuKMABloUn tfLoHTMsR8xc3mzoMLJmQpi7T/QL9NQ75VNiev6g/RIqToQ0ThCYNDjaJrebH9AijJg3 rkrePLuXKA6aOxiJi99NLPEH6Ky1qPvKKLekmjUC1FI9h4dh/1RUtKmMsubN5zgBp599 Y2knNvawI624P/zGpkRUzR1krpw+9HJKXEfSXixJY3SmDNyecT3OtYs/z9ZLMIUwlc0e 7rgXGyFc5jN+KU21zaODPwOdaDQ/yrOhgx5h/tpH3qeQENjU7ShEd5L/a/MKboiCPtH1 iUKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cCDk/erGUZ/u3ecrMonx4NhH5B0mUzK61fX+A9ryTCk=; b=qDbik5U/Hag65sdJtaoLW4ShyTzrwQ6qiqmoCypJa0+4kHAkp4K9H8aE5eYpG44ECk r3AMVjtuyjrqk5ggLqdAwFfJ4kA7827/G3Kai3S+Lnf9Txx+Yuu1J/fCX8fZ99bxE/rJ wkKUnTuPv7PifblFIV8cKXJ+LpJfXT/8rjoCVD6l9lWoXqAlDqPcXbUuyO6r7J3GwCaB 7cC4Pb8gEQqKw0npFJjut24PoENqs2N1W+YRVWmTNtus/AMDdO4znMf78/4+Zk+X1G8F IEplCuIqY06JDoEuuZB6AOYf7lQvDFduOApEEb5LvngpigJoZ7eobeBRiM9QF6ckNVr0 rNfA== X-Gm-Message-State: AJIora/xfZKKsPgEDMNPOp26jAnc5bE6y9zx+XNJET55/lcyESq3ZZ9+ TKBSjjV/lEPVGhk5EbbPre5Pef4G5SuBPJn0OFLQn3C1m+rs8A== X-Received: by 2002:a2e:a5cb:0:b0:25d:7a70:2891 with SMTP id n11-20020a2ea5cb000000b0025d7a702891mr3153421ljp.295.1657758728120; Wed, 13 Jul 2022 17:32:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nick Desaulniers Date: Wed, 13 Jul 2022 17:31:56 -0700 Message-ID: Subject: Re: objtool "'naked' return found in RETHUNK build" with clang + CONFIG_K{A,C}SAN=y To: Nathan Chancellor Cc: Josh Poimboeuf , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Peter Zijlstra Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 3:05 PM Nick Desaulniers wrote: > > On Wed, Jul 13, 2022 at 9:42 AM Nick Desaulniers > wrote: > > > > On Wed, Jul 13, 2022 at 9:25 AM Peter Zijlstra wrote: > > > > > > 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 > > It's not just the sanitizers, `CONFIG_GCOV_KERNEL=y` + > `CONFIG_GCOV_PROFILE_ALL=y` also has this issue: > ``` > ... > drivers/base/platform.o: warning: objtool: __llvm_gcov_reset+0xa94: > 'naked' return found in RETHUNK build > net/core/netpoll.o: warning: objtool: __llvm_gcov_reset+0xde3: 'naked' > return found in RETHUNK build > net/netfilter/nf_conntrack_netlink.o: warning: objtool: > __llvm_gcov_reset+0x1b94: 'naked' return found in RETHUNK build > fs/fs_parser.o: warning: objtool: __llvm_gcov_reset+0x344: 'naked' > return found in RETHUNK build > drivers/acpi/debugfs.o: warning: objtool: __llvm_gcov_reset+0xb: > 'naked' return found in RETHUNK build > mm/pagewalk.o: warning: objtool: __llvm_gcov_reset+0x77f: 'naked' > return found in RETHUNK build > drivers/tty/serial/8250/8250_pnp.o: warning: objtool: > __llvm_gcov_reset+0x231: 'naked' return found in RETHUNK build > fs/init.o: warning: objtool: __llvm_gcov_reset+0x2f7: 'naked' return > found in RETHUNK build > drivers/gpu/drm/drm_fourcc.o: warning: objtool: > __llvm_gcov_reset+0x1ce: 'naked' return found in RETHUNK build > ... > ``` https://reviews.llvm.org/D129709 > > > > > > > > > > > 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. > > > > https://github.com/llvm/llvm-project/issues/56514 > > > > -- > > Thanks, > > ~Nick Desaulniers > > > > -- > Thanks, > ~Nick Desaulniers -- Thanks, ~Nick Desaulniers