From patchwork Mon Oct 26 20:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11858789 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, 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 13350C4363A for ; Mon, 26 Oct 2020 21:01:58 +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 9D8A420829 for ; Mon, 26 Oct 2020 21:01:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hA42UnGP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="kvlUTuZa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D8A420829 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:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=D41QQRR6JGdpA7YAshb/5T0HOpKhJ0UBLUlRYGOE63Y=; b=hA42UnGPXaqJcWh12haap/78a erVp4Eqw8E4i06iB5orqs+hJWqX9T8ShiJBhl49m8SEDXd06sm7/peIq7ldq/cF4E4AW+lWvrNxwd VGnTLLYDkVXBN5MahRC1pD6hEZAGneeoibESwlc4EUNL/SvNCLOD3hYbEWfId9Q/XCvIS+KROAqpK uuoPfEQ8C+rUsjcUOy8Xjn04kxeC81UVexkyUnVjoibotiTxzLogql3CydOHgLmACkmBagbxn5T+Y /1366H1ibBJB9Og2KRB1vzJ+sOqq6Ej7Z1baeuoQeTRRRGfCymfhpJie3WVQoB5ZdBcyRY3dYU8ZJ LHl8GaRKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX9bD-0006a1-8y; Mon, 26 Oct 2020 21:00:16 +0000 Received: from mail-qv1-xf4a.google.com ([2607:f8b0:4864:20::f4a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX9b7-0006YL-NB for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 21:00:10 +0000 Received: by mail-qv1-xf4a.google.com with SMTP id es11so6476845qvb.10 for ; Mon, 26 Oct 2020 14:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=X0yJy326mTXqT8z7VLXBqHHJlGQSthYJ/ieVxPgPPpA=; b=kvlUTuZaF8D+KC8GYJd7SgVJeOc2YUYNKAjv2s52yWN7iU/PmSXep0pWeEu0gGThE0 Ue+zz2Swv60wbLbhjL0NUEPc/yHLAR53Jpo/D4sslCrGofg0qby8gmLXkp+WdPdOyUyM HQGVhOEfZlqbGg21lME2UIPmA38KHqQgGcwj28XYWhYcranRJFNt2inpShe4jf+Kgbt4 zL67VUyJir2uZeoyRnOtQKU34t+P05xsDAbnb4KAlB6vlU7XndCXzun+8pv05hXPCtze Cs98EwAGWbjocbwfYFntFhGIASLgo8I9/ZA+97QSDfGePoH5CLH3yni2YB+gyZdHSxqL UOFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=X0yJy326mTXqT8z7VLXBqHHJlGQSthYJ/ieVxPgPPpA=; b=Nl+tvrvakKxV0OEHSVu1KXsCU0MP27++zcqqxNoXWl7m86YUmk8B+AssH1Jp0+BY4e IFpfy+XlNZesNPlrjKV5MMxedXG4tfZKBpJ2/EjpLVePfczuveLt2/s4YMjeMlZX/sPV 9VAM3kBny5Kt6bKCosfgpvrJ/souDfWLCALUm+x/7GbyqZNQ3ALiQycJu6KAkJExnG8o D8+I/Uz5QduP+/VhKE7B5dccvSNeljOF1gVn+01vaQBAjW4YOQyRSiBOhRIQ+vvxkfZx VLuMn2nV83QfKd7uJ9jmf9jsVIZo6egosX7u0kOD09Y2vOup/3GCTYkdM1pPXw2sfv79 fWyA== X-Gm-Message-State: AOAM532UdxG17e/MIVNAUg/g2MlKjr1QD02vhoOQ62Yo9yMdlsXaCAgE UD1KQ9bD0OdARlojxAocrY8PffU= X-Google-Smtp-Source: ABdhPJz6FxahU0Dq1xo/wyFK3GOYOtFyxF9A+X+eulQWH7fgfFDwSs3wthd9zgywJ3q8A6VJ5ckcmMQ= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:ad4:4e47:: with SMTP id eb7mr20164521qvb.34.1603746005548; Mon, 26 Oct 2020 14:00:05 -0700 (PDT) Date: Mon, 26 Oct 2020 13:59:56 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.0.rc2.309.g374f81d7ae-goog Subject: [PATCH v2 2/2] arm64: stacktrace: Relax frame record alignment requirement to 8 bytes From: Peter Collingbourne To: Mark Brown , Mark Rutland , Will Deacon , Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_170009_808430_D69F65B1 X-CRM114-Status: GOOD ( 16.58 ) 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: Andrey Konovalov , Peter Collingbourne , Linux ARM Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The AAPCS places no requirements on the alignment of the frame record. In theory it could be placed anywhere, although it seems sensible to require it to be aligned to 8 bytes. With an upcoming enhancement to tag-based KASAN Clang will begin creating frame records located at an address that is only aligned to 8 bytes. Accommodate such frame records in the stack unwinding code. As pointed out by Mark Rutland, the userspace stack unwinding code has the same problem, so fix it there as well. Signed-off-by: Peter Collingbourne Link: https://linux-review.googlesource.com/id/Ia22c375230e67ca055e9e4bb639383567f7ad268 Acked-by: Andrey Konovalov --- v2: - fix it in the userspace unwinding code as well arch/arm64/kernel/perf_callchain.c | 2 +- arch/arm64/kernel/stacktrace.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c index 88ff471b0bce..4a72c2727309 100644 --- a/arch/arm64/kernel/perf_callchain.c +++ b/arch/arm64/kernel/perf_callchain.c @@ -116,7 +116,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry, tail = (struct frame_tail __user *)regs->regs[29]; while (entry->nr < entry->max_stack && - tail && !((unsigned long)tail & 0xf)) + tail && !((unsigned long)tail & 0x7)) tail = user_backtrace(tail, entry); } else { #ifdef CONFIG_COMPAT diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index ce613e22b58b..3bc1c44b7910 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -44,7 +44,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) unsigned long fp = frame->fp; struct stack_info info; - if (fp & 0xf) + if (fp & 0x7) return -EINVAL; if (!tsk)