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=-8.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 26C44C2D0E4 for ; Thu, 12 Nov 2020 18:52:31 +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 9117C22228 for ; Thu, 12 Nov 2020 18:52:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ToxueCI7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="k01pYQ5H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9117C22228 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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=DMCJnBXy3tjRvOXtFQZGlNUe6ynCQXhHNXO81q2YVbI=; b=ToxueCI7NBE9PF/qBelQBfsEq zcY9OVc9lIrp04owZLA+0+PxeceeOmjXAnIN3NkTi5uxaETd9kNYBcGmve1xY36W+OobJbWJVUuct JjMsaXwvhZoJcZnb0a/Bq7iHwkmYzdMLkddYkh4FZmpLWW+p/vT0TKPW2wzr2TEh3hF6/NwVWYcbM 1SgRyWGa6wvfUkvDqajw3mJt6StSfPFSmUsG9Ux3/uL689SXlgntZ1rQHd0hRjYRQyqAlAeg7LDyZ pK1U/k9iR7mcQjgjuz5XpDOXq5P1Xe688vo6j4bceNZr5ZZ/2ZDjgC7wP9P5to2wp7mvBR4MjhdSH /mBpIJyRQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdHhF-0002aY-Sw; Thu, 12 Nov 2020 18:51:49 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdHhD-0002Zs-BR for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2020 18:51:48 +0000 Received: by mail-pf1-x443.google.com with SMTP id a18so5391041pfl.3 for ; Thu, 12 Nov 2020 10:51:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RaVZ5jM2Kq305TknFdq232t++qdgFqkARu+DxrhGvhw=; b=k01pYQ5Hf6kJ1SYxIRgRrYC+IjYSruWAzp1Sf4DrFIHHHtX7vtLVp+1M2+xLmsUEWz 85BuREFwJrN8AygA5FG/Cia8YTgzBEc1FtGjYXNSJ7tWHJmOkbg/8Eoz7x+YwQV7VEEc JvtcNnjje92yVghJshGR5sYaImJwCleNqSq+7CIH33qUHbDZ5Gtq2vi3TL+Gk7zBXN9Y UStSsNsS6/VD/oxomEJd7CC0N9G37OWykfxgvik+vwQAH2EYrjom5gyYOOi9aNT6HrT/ TMOK0U7+sKos4mIzObAK4dfT0pDVoQg/9gWXdDV/wlCTRfw1GCWRkr0C2VV2ZbLShd01 hDKw== 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=RaVZ5jM2Kq305TknFdq232t++qdgFqkARu+DxrhGvhw=; b=sMx/Hr2whA67fOf5PNeHER+lyGYSlBl7iMcVkfPhBxj00QGDGM820taXujFApeT1m9 hEV1pGQXx0NDvRlkmqa97Fck968MIEH8Y4sJGQ18nCKpCQ5erVkCHudhAt4He0IrEofi wAWMOxrQrXy5qTm1AWbeqWK9nMeG1enVtu1h/NfQLlAo6WsNE4hvPlX+v9Zp5p75pLSe tcmlpeYRkPdN6fCPNEVHrrh3AmgUnD362t1e1UY7Pk5UZwSy7hVZd4hNbNiXGg+2thzg myOhcpZK8GYOdShH/ZlaxOfom57+KgLXEZ6chpZI6kyZGRObcYkzTwmD+qp+8Uo4vs1k fGgA== X-Gm-Message-State: AOAM530uhZnX6DL9j7XtMT0oRPABwwuNU10vUq12drO94fSCpmtS0Xh0 INV8/Jt+lm9qpyR29nOuPkYZlg== X-Google-Smtp-Source: ABdhPJwP4mdW68OARGlJ0t9NI8QWmMpS2Pf3Qqj2Q0RDhpx5qiPCzdJNFkbGKrc7eiUgLswR2wHT7g== X-Received: by 2002:a17:90a:8543:: with SMTP id a3mr600513pjw.13.1605207101503; Thu, 12 Nov 2020 10:51:41 -0800 (PST) Received: from google.com (15.4.198.104.bc.googleusercontent.com. [104.198.4.15]) by smtp.gmail.com with ESMTPSA id k21sm6824459pfu.7.2020.11.12.10.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 10:51:40 -0800 (PST) Date: Thu, 12 Nov 2020 18:51:36 +0000 From: William Mcvicker To: Will Deacon Subject: Re: [PATCH] arm64: Fix off-by-one vdso trampoline return value Message-ID: <20201112185136.GA585063@google.com> References: <20201112001422.340449-1-willmcvicker@google.com> <20201112101204.GA19506@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201112101204.GA19506@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_135147_431133_51B0875E X-CRM114-Status: GOOD ( 28.72 ) 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: Catalin Marinas , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Andrei Vagin , Dmitry Safonov <0x7f454c46@gmail.com>, Nathan Chancellor , Vincenzo Frascino , kernel-team@android.com, Thomas Gleixner , linux-arm-kernel@lists.infradead.org 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 Hi Nick, Regarding llvm-nm, this extra thumb +1 is noticed after porting https://lore.kernel.org/linux-arm-kernel/20201013033947.2257501-1-natechancellor@gmail.com/ to the Android Common Kernel android-4.19-stable. I'm not sure why using ld.lld causes this difference, but this proposed patch ensures that we don't rely on the nm tool used. Will D., Regarding applying this to some stable kernels vs backporting 2d071968a405 ("arm64: compat: Remove 32-bit sigreturn code from the vDSO"), I am hesitant to backport commit 2d071968a405 due it's dependencies. For 4.19 at least, I would also need to backport these: 8e411be6aad13 will@kernel.org arm64: compat: Always use sigpage for sigreturn trampoline a39060b009ca0 will@kernel.org arm64: compat: Allow 32-bit vdso and sigpage to co-exist 1d09094aa6205 mark.rutland@arm.com arm64: vdso: use consistent 'map' nomenclature d3418f3839b66 mark.rutland@arm.com arm64: vdso: use consistent 'abi' nomenclature 3ee16ff3437ca mark.rutland@arm.com arm64: vdso: simplify arch_vdso_type ifdeffery 74fc72e77dc5c mark.rutland@arm.com arm64: vdso: remove aarch32_vdso_pages[] I have done this in my local tree and verified it fixes the SIGBUS error I'm seeing; however, it seems a lot cleaner and safer to just patch the VDSO_SYMBOL macro. Please let me know what route you prefer. I'm happy to backport all of these if that's the recommended approach. Thanks, Will On 11/12/2020, Will Deacon wrote: > On Thu, Nov 12, 2020 at 12:14:22AM +0000, Will McVicker wrote: > > Depending on your host nm version, the generated header > > `include/generated/vdso32-offsets.h` may have the bottom bit set for the > > thumb vdso offset addresses (as observed when using llvm-nm). This > > results in an additional +1 for thumb vdso trampoline return values > > since compat_setup_return() already includes `vdso_trampoline + thumb`. > > As a result, I see a SIGBUS error when running the LTP test > > syscalls.rt_sigaction01. To fix this, let's clear the bottom bit of the > > vdso_offset in the VDSO_SYMBOL macro. > > > > Test: LTP test syscalls.rt_sigaction01 > > Fixes: f01703b3d2e6 ("arm64: compat: Get sigreturn trampolines from vDSO") > > Signed-off-by: Will McVicker > > --- > > arch/arm64/include/asm/vdso.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h > > index f99dcb94b438..a7384379e8e1 100644 > > --- a/arch/arm64/include/asm/vdso.h > > +++ b/arch/arm64/include/asm/vdso.h > > @@ -23,7 +23,7 @@ > > > > #define VDSO_SYMBOL(base, name) \ > > ({ \ > > - (void *)(vdso_offset_##name - VDSO_LBASE + (unsigned long)(base)); \ > > + (void *)((vdso_offset_##name & ~1UL) - VDSO_LBASE + (unsigned long)(base)); \ > > I don't think we need this in mainline, because the sigreturn trampoline > is just a bunch of .byte directives and I removed the sigreturn code from > the compat vdso in 2d071968a405 ("arm64: compat: Remove 32-bit sigreturn code > from the vDSO"). > > Might be needed in some stable kernels though (or we just backport the > patch I mentioned above) > > Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel