From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70852C00A89 for ; Fri, 30 Oct 2020 09:11:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9F92206DB for ; Fri, 30 Oct 2020 09:11:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1FcCbgLx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nP4akuGm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9F92206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BWgjG7m/v/mpAvXXwRtz4TAAui0E1gqwApB4R+358pY=; b=1FcCbgLx3nhX4KS7QMiI3TeE/ y4N1xXDw6SOSRY7+hBo5yx1qjN7x4+XxW24u4UaNHZniWKmJ49jOaq7yEaadkOj1VZkgtxZxeJ58F eV2RH8SfrULyl973e1/ydumJq1iBAEk6q1EUmknKejCU6iCn87MzOABSc2F22CKp+/cGEHrtUyyxn 4fWv9AIRa0d5EEvlJUqX6fWH0V8RlrLqlHU+umxopwYR+EPQ/UDDRZAHVvnP2KFqtM9DQUR9jPqQE H+I5zT8zNkJjDzieir/tTEg+Eb76i5rTVsSqNiWWTrnQeMznTigj2YIa+YVesmHq+8eLAvRs5mTLv I0p62bGaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYQPw-000401-OS; Fri, 30 Oct 2020 09:09:52 +0000 Received: from mail-il1-x143.google.com ([2607:f8b0:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYQPt-0003zN-IR for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 09:09:50 +0000 Received: by mail-il1-x143.google.com with SMTP id n5so5863081ile.7 for ; Fri, 30 Oct 2020 02:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RPHdRVjaOHzwGl9kP1HFBqGh6vFVZBs7d9edYGnkNbM=; b=nP4akuGmlZnb4LBXFN9VSZkOsbSIMc9Sq1x0SOPVVRuVV9VlfIN+ucPiijgVRT6/ox EMFw/I6E3JHEPRBxO886yd5pi0YJt/XzdxEOBqvD6w18qtLtMZJDoZdcg/e/1e7u+JXQ d1J9kuOcEbteGgGLbhP8NltFTIbQ9Np39zkpnWTtM2iOBTs7h+2YSi4vlmBmyj3v6NdS Py4VXGW0Zrjykcbd41cI+NALvzctRnaY5/6Pafu9m5H6rlSIzdoQcX1vmRRX+svzLAKk izXfALpAXIznUcZa0kKMWXJkGxQsla9nrNrKEe9CPCZDT1xZznBZ2vfm067aWhW17pa1 B1Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RPHdRVjaOHzwGl9kP1HFBqGh6vFVZBs7d9edYGnkNbM=; b=fRfB0c2HVaelALXPzIu3pNZK2DoBg1Z4m/iBqybxfUS4z1EalfL8pa+joWG/iclGqP dBPyRenF3K8hwR/Os7FaQEfNbRy04xbRoLUz1YSguDTgis7/P0Sg5vo+7aCAFNIARrk9 vqB72JSZ3t1zFOR0dxsWVme9vnedYtDoNMOwVoigd2sk4N/vgJe+vop4fC4FuisUvi1/ M7Pg4VVBF2OLNsAauqGyZLJKS6uT2vuLYUQ2xsSYZKCNCyVsvczgtwOiHKuUmS3kXDht 8xi6g6vKQrH8H8U9nFzgxiQyxfeSC/w4zeCgjp5sVqeG7PLC/R2NlLbEXNvZUWmtp6sU O+MA== X-Gm-Message-State: AOAM533QIGmbIeOgRv5Odf4S5Vu4NvG+TYwEZPv1MpKZNMvpD2WlCGQH wXgZH1hf0OxR3xYH5lYoEMM= X-Google-Smtp-Source: ABdhPJwle+VLwTD/CtaU+d2SrIhvzqQJqUQx1bxq17GtmeNQ60ewtRZft01fw4GAQcBw4a3bjsfnPw== X-Received: by 2002:a92:cecf:: with SMTP id z15mr1090371ilq.214.1604048987731; Fri, 30 Oct 2020 02:09:47 -0700 (PDT) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id m66sm6125201ill.69.2020.10.30.02.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 02:09:47 -0700 (PDT) Date: Fri, 30 Oct 2020 02:09:45 -0700 From: Nathan Chancellor To: Arnd Bergmann Subject: Re: [PATCH 0/5 v16] KASan for Arm Message-ID: <20201030090945.GA3635064@ubuntu-m3-large-x86> References: <20201030002900.GA2248731@ubuntu-m3-large-x86> <20201030013228.GA2519055@ubuntu-m3-large-x86> <20201030075655.GA1848109@ubuntu-m3-large-x86> <20201030080438.GA1849056@ubuntu-m3-large-x86> <20201030084519.GA3748061@ubuntu-m3-large-x86> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_050949_639553_A8975799 X-CRM114-Status: GOOD ( 28.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Arnd Bergmann , Abbott Liu , Linus Walleij , Nick Desaulniers , Russell King , Mike Rapoport , clang-built-linux , Andrey Ryabinin , Will Deacon , Ard Biesheuvel , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 30, 2020 at 09:51:27AM +0100, Arnd Bergmann wrote: > On Fri, Oct 30, 2020 at 9:45 AM Nathan Chancellor > wrote: > > On Fri, Oct 30, 2020 at 09:10:56AM +0100, Ard Biesheuvel wrote: > > 4043 futex_hashsize = 1UL << futex_shift; > > (gdb) > > 4045 futex_detect_cmpxchg(); > > (gdb) > > I can't explain it, but I'd point out that futex_detect_cmpxchg() has caused > problems in the past, with multiple patches for it proposed in the past > and none of them merged. One of the patches I had sent for it was: > > commit 8232a8ffc332fa6a50296a51c4d85200a747256c > Author: Arnd Bergmann > Date: Mon Mar 4 17:33:00 2019 +0100 > > [SUBMITTED 20190307] futex: mark futex_detect_cmpxchg() as 'noinline' > > On 32-bit ARM, I got a link failure in futex_init() when building > with clang in some random configurations: > > kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: > R_ARM_JUMP24 against `.init.text' > > As far as I can tell, the problem is that a branch is over 16MB > apart in those configurations, but only if it branches back to > the init text. > > Marking the futex_detect_cmpxchg() function as noinline and > not __init avoids the problem for me. > > Signed-off-by: Arnd Bergmann > > diff --git a/kernel/futex.c b/kernel/futex.c > index e646661f6282..6fbbed45f51b 100644 > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -4061,7 +4061,7 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, > uaddr, int, op, u32, val, > } > #endif /* CONFIG_COMPAT_32BIT_TIME */ > > -static void __init futex_detect_cmpxchg(void) > +static noinline void futex_detect_cmpxchg(void) > { > #ifndef CONFIG_HAVE_FUTEX_CMPXCHG > u32 curval; > > I forgot what the problem was, but you might try that patch, or find > the previous discussions in the archive. > > Arnd As it turns out, that is the patch that fixes the ld.bfd issue that I mentioned earlier in this thread and it fixes this issue as well. To summarize, with the below diff, I can successfully boot multi_v7_defconfig + CONFIG_KASAN=y when LLVM=1 is used (and I see KASAN get initialized properly). Cheers, Nathan diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 4d76eab2b22d..3c0a64cefe52 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -10,7 +10,7 @@ # # Copyright (C) 1995-2001 by Russell King -LDFLAGS_vmlinux := --no-undefined -X --pic-veneer +LDFLAGS_vmlinux := --no-undefined -X --pic-veneer -z norelro ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) LDFLAGS_vmlinux += --be8 KBUILD_LDFLAGS_MODULE += --be8 diff --git a/kernel/futex.c b/kernel/futex.c index be68ac0d49ad..226bb20d175f 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -4004,7 +4004,7 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val, } #endif /* CONFIG_COMPAT_32BIT_TIME */ -static void __init futex_detect_cmpxchg(void) +static noinline void futex_detect_cmpxchg(void) { #ifndef CONFIG_HAVE_FUTEX_CMPXCHG u32 curval; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel