From patchwork Thu Nov 12 00:14:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William McVicker X-Patchwork-Id: 11898723 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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8DEF2C388F9 for ; Thu, 12 Nov 2020 00:15:52 +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 E79C42072C for ; Thu, 12 Nov 2020 00:15:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qOdCdsJh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="edtKqlHv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E79C42072C 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:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=RJOI+SjoN0KdR7cpONyl/e+TG8UJUTVcYO79jqy+K48=; b=qOdCdsJhOkQftGfNugvAAeeT+m AiQ4/nFoAB8tL0TekLQbYx9nAwjRTCpm2zO0B0O2B9F5isllXr7RlX1JClqYUsqmrE78ZDdFquzFd B3gF6wnV7kwak1HadjgBnP+tepAON7Wnt9aGqZDwM86vHnzybiHVDxL+0H8USOc12EdA4DBe+7XUZ uocd6TEexA0SWs7+xv4ZtCz3JdIO64ufjfsvxSqxSzV+xrzoHttOXKAd9W/HTtJOpB3ZGdM7uftW9 b24/5ozMHxD3zptL3ECCsCrCU+OWyeU+449/VCIzROGPWIIVx4T5mvIVM0fMtEfSGDfG6IDdcHNQV 850Bxchg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kd0Gh-0001Xk-1H; Thu, 12 Nov 2020 00:15:15 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kd0Ga-0001Wt-Nm for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2020 00:15:09 +0000 Received: by mail-pl1-x64a.google.com with SMTP id n10so2126554plk.14 for ; Wed, 11 Nov 2020 16:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=Zc4FtrffhJ40dHokDMmzk3M0beSaAvptI8ZzV5EZfTw=; b=edtKqlHvgZlW+FjvLnkQmKTA3zEOpxEYi6Tkz6gJqeYD7PyLxNtTWTDhJX6t05Idju BY0G0dn6KAvUFi7MXCQSbXF+NT6OJKSzba6ksDTZP5Ej1pKLgLhVzCrOOxzzfKXsvqVi BPUC4qgWhKzJ+7vVqDfkJFVmhUwqlxFHGVRmi/7MDMHin5hjoLxHtd6gOoUT3LgYLCNd XZ6TkAYnV+ZxT8qtktz23J28XW8y5WnfFna7QE/Gi2eCph2iMIiHHr6twGEAptqFsC97 lWTjDHDJsz329WpP2ygEtU1E7DebwDFMaHOWM0U5aicvZPfYbE8JELoDrjn4dqQhurqp mzbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=Zc4FtrffhJ40dHokDMmzk3M0beSaAvptI8ZzV5EZfTw=; b=kTwjNGOiPr6WkpYrN8YfVh2As4KqpcXJVB0HXlKE8atHHUGcRnxmMKujcl9oWPcp0U 1Tu3TrN2ucuFpsh+R3yClDsuGYq23Cd1cuH3BDfCgJkBXrVhkHWGGVFGuJJFzqvMsv0H swtbtghIVONhO18bytA1sTZytnnviJGegOEbM27h9PRIqbXLs80uQ1ybAhpDhyRUEcHa d5wyvZyrFgnkPAD4tJTLMQ0b8zV8H4J01vmOLSeqxW0gU1w1lfqpOhDVQWzrSEsUMSiy uulxxM+b9VSacXwUdyzQhIqYrrfCUS+AvMigtp2XbZufwpR9d82Xy9wVMnAWzEHQnlS2 5K1w== X-Gm-Message-State: AOAM532smn/8+jbB7UstGpQZslQ0NLCcfPmG6mLi1Aas/RHe7Cmrmcsk vrgPnZBXjrGrDyiTPAJ1kF1zw6hfRR0aZmL5tF0= X-Google-Smtp-Source: ABdhPJznT1kj3LnCLLY8r9Vwp5fimyEq6m0h5lY5KmuN1jkZqcR5zYfTDMzE0HwLGzNzG8VkxWRJmf9yFVrhRc7N3Cs= X-Received: from willmcvicker.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:2dd0]) (user=willmcvicker job=sendgmr) by 2002:aa7:8055:0:b029:15f:cbe9:1aad with SMTP id y21-20020aa780550000b029015fcbe91aadmr25173195pfm.71.1605140096514; Wed, 11 Nov 2020 16:14:56 -0800 (PST) Date: Thu, 12 Nov 2020 00:14:22 +0000 Message-Id: <20201112001422.340449-1-willmcvicker@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH] arm64: Fix off-by-one vdso trampoline return value From: Will McVicker To: Catalin Marinas , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_191508_933992_0A2DF653 X-CRM114-Status: GOOD ( 15.08 ) 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: Will McVicker , Nick Desaulniers , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Andrei Vagin , Nathan Chancellor , Vincenzo Frascino , kernel-team@android.com, Thomas Gleixner , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)); \ }) #endif /* !__ASSEMBLY__ */