Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7242940rwd; Mon, 19 Jun 2023 21:18:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DovPtx6vLDi9DB23TRJCgU2ATINuToJM3OzhoAUhdtEshMBIF6hlWz/5PrK6zPuLnGJg8 X-Received: by 2002:ac8:7dc5:0:b0:3fb:9c79:ac1b with SMTP id c5-20020ac87dc5000000b003fb9c79ac1bmr14998833qte.3.1687234698006; Mon, 19 Jun 2023 21:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687234697; cv=none; d=google.com; s=arc-20160816; b=U+8guKS9G2U/grEIsAaJjqdY1vAFJGuf/tXm3ZB1/BNkv7vHFtIULo+eyJKnrX6rJz ZI+m04TQAlC1riWKA2PMAITQoCvfxikY1awi6EN9diy7dB9SM5o57/1D4Yzp/MjV3Cd2 i4b6r2KoNfpGa4FCk9QUZY6PGTKWBe7AsiueYRaLgybxT7WqITk+N9ifOXANnZqV+IYF mg6SPsi23WZV4GerlbhrywOuqjSeqeVX8tLB3sXmBLpdpzqPUD5zwOzWutRELFAzV+dx eDfQ99Zr/cURGt01qNEjxVkwMRIcYeab3WU3vrQZNUvqYzEmHkbaGe6dIYB+s2JIX7MB 71lg== 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; bh=dZfRwIeBBVeGV7EGtniVe49AMgThuhhYdrRcqxpl3R0=; b=OnBoxh57C/dRuSmRmMxToNJYfyS3XdKBBUXvCKxoSLcKglvl8mnYOTJVt45SJrq30T sU7fE5XBejGeLkpS6dtbHE3scBjWAy4Vm0hldC7PfSUrTIBkGpD5gRxUBJOeBATWDb3C yW72MUnFqNOB5HzLN8MW0GkZQivzezv1eo7KQU4aKdGKLXeSUS8jsdA2vqE6R8LEYESL EoKzxstH30nzNWQpedFDDcK2/GBwBgWMoVyEmr7kSJf6T3AJitH9+oHppNy5kW5JtkVC nyyfsSTu5U2vj4777eTxmvw+4Nwyx3AhiSpSIDN70JjJo2p6t0R6oTHSIPuT7akhcMPR GBQQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fjasle.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0054fec14fa50si800121pgb.841.2023.06.19.21.18.02; Mon, 19 Jun 2023 21:18:17 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fjasle.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229902AbjFTEOR (ORCPT + 99 others); Tue, 20 Jun 2023 00:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbjFTEOP (ORCPT ); Tue, 20 Jun 2023 00:14:15 -0400 Received: from mail.avm.de (mail.avm.de [IPv6:2001:bf0:244:244::94]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C506810D2; Mon, 19 Jun 2023 21:14:11 -0700 (PDT) Received: from mail-auth.avm.de (dovecot-mx-01.avm.de [212.42.244.71]) by mail.avm.de (Postfix) with ESMTPS; Tue, 20 Jun 2023 06:14:03 +0200 (CEST) Received: from buildd.core.avm.de (buildd-sv-01.avm.de [172.16.0.225]) by mail-auth.avm.de (Postfix) with ESMTPA id 7211380C47; Tue, 20 Jun 2023 06:14:03 +0200 (CEST) Received: by buildd.core.avm.de (Postfix, from userid 1000) id 5F279182086; Tue, 20 Jun 2023 06:14:03 +0200 (CEST) Date: Tue, 20 Jun 2023 06:14:03 +0200 From: Nicolas Schier To: Masahiro Yamada Cc: linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, Ard Biesheuvel , Nick Desaulniers Subject: Re: [PATCH] ARM: change link order of $(mmy-y) to avoid veneers Message-ID: References: <20230619143725.57967-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230619143725.57967-1-masahiroy@kernel.org> X-purgate-ID: 149429::1687234443-9D4ED0AE-9095512A/0/0 X-purgate-type: clean X-purgate-size: 2587 X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, 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 Subject: [PATCH] ARM: change link order of $(mmy-y) to avoid veneers There is a typo in the subject (mmy-y -> mmu-y). Kind regards, Nicolas On Mon, Jun 19, 2023 at 11:37:25PM +0900, Masahiro Yamada wrote: > The kernel compiled with multi_v7_defconfig + CONFIG_KASAN=y + > CONFIG_KASAN_INLINE=y does not boot. > > I do not think KASAN is the direct reason of the boot failure. > CONFIG_KASAN_INLINE is just one example configuration that grows the > image size significantly and makes a big distance between function > callers and callees. > > I see some veneers for __get_user_* in the bad kernel image. I am > not perfectly clear, but __get_user_* may not work with veneers for > some reasons. > > If I move the link order of arch/arm/lib/getuser.S, the veneers are > gone, and the kernel gets working again. > > I do not see a good reason that $(mmu-y) must be added to lib-y because > all the code in $(mmu-y) is mandatory. Add it to obj-y to move the code > to lower address. > > [1] multi_v7_defconfig (works) > > $ arm-linux-gnueabihf-nm vmlinux | grep __get_user_1 > c072a450 T __get_user_1 > c17ea033 r __kstrtab___get_user_1 > c18119fe r __kstrtabns___get_user_1 > c17c4878 r __ksymtab___get_user_1 > > [2] multi_v7_defconfig + CONFIG_KASAN_INLINE (does not work) > > $ arm-linux-gnueabihf-nm vmlinux | grep __get_user_1 > c341ec2c T __get_user_1 > c06e3580 t ____get_user_1_veneer > c0adc6c0 t ____get_user_1_veneer > c12cf054 t ____get_user_1_veneer > c43f42cc r __kstrtab___get_user_1 > c441c128 r __kstrtabns___get_user_1 > c43cead8 r __ksymtab___get_user_1 > > [3] multi_v7_defconfig + CONFIG_KASAN_INLINE + this patch (works) > > $ arm-linux-gnueabihf-nm vmlinux | grep __get_user_1 > c10975b0 T __get_user_1 > c43f42cc r __kstrtab___get_user_1 > c441c128 r __kstrtabns___get_user_1 > c43cead8 r __ksymtab___get_user_1 > > Signed-off-by: Masahiro Yamada > --- > > arch/arm/lib/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile > index 650404be6768..4d092ef87a1d 100644 > --- a/arch/arm/lib/Makefile > +++ b/arch/arm/lib/Makefile > @@ -28,7 +28,7 @@ endif > # using lib_ here won't override already available weak symbols > obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o > > -lib-$(CONFIG_MMU) += $(mmu-y) > +obj-$(CONFIG_MMU) += $(mmu-y) > > ifeq ($(CONFIG_CPU_32v3),y) > lib-y += io-readsw-armv3.o io-writesw-armv3.o > -- > 2.39.2 >