From patchwork Mon Oct 31 21:57:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuniyuki Iwashima X-Patchwork-Id: 13449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2572780wru; Mon, 31 Oct 2022 15:06:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kdnftQPuGqwoSB79NOgx5/AGAfSpsvSh1CYbv9WLecYfmbyN4/8s20C74oZuYQwSiwmks X-Received: by 2002:a63:2f47:0:b0:46f:e657:4204 with SMTP id v68-20020a632f47000000b0046fe6574204mr1414129pgv.39.1667253968829; Mon, 31 Oct 2022 15:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667253968; cv=none; d=google.com; s=arc-20160816; b=kf+CfSuRbxn03/CelbXQu7b+I0YNo/Q0AM1aVGgT9HkKdRszA6/jhc3Qn/ggxcwuKs C5c72V21I9DX/O/4lQ9MftyqguFUkWjZ7Vy7o/ndJbiCCLb98WE2vimQoyOBQq7mHre0 o1+uR2477BkiTo9pMQ68atsxyW2aAD4m5n+3s2624zFwu7kFChDLuC1WfOvovvsnH6/1 3WGOm3Q1YSBFZY4Ki7ZxQqyoiccZyFSyVlO4ec5rtyQFwXACldmilUS7z95kRBzNj3WX A/ph3tLLVerYZah6s3g//FLVUa+EysZSJGiA8VoHhxMIkTxGmydDr1vmxGqWiUQcl4o0 eKFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lrb22HZ6Jnm7ozydurS59fLEB2TfDlJmL+nE6nHtD1o=; b=h3kZo6d2sC11FwapRbx7zqb6i8AEh8+yyJFvuu/szxKOhJf9iUQL3t57pxEDF8ICar K69Og1PEOEczW3aq6jifraqy8J171Pk41lQZz76M6iwg6MR9oypZMChAfmO3/Oy2MNk3 WAzt9hxlNuNUiwV6wNG3/ElVjSiVD6p4corsEJ9CHSAVjOHRTqxCAt+zcqxSrqdoJLHf BtVyqRZVp/ltmVtXb0H1Fu3tT6NuP16vu/cEOdUuz8QctuS1Wh1WSlppZvIhzsfVhL4i S7IUMlpARdlA86QTGtToRPcKXXpjafoxeSEd/8pT+dvaAUsR6WDgNXQ3WvFNM5h9MhUn qxmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=KlWg00NJ; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170902848a00b00186c3afb4besi9312428plo.243.2022.10.31.15.05.37; Mon, 31 Oct 2022 15:06:08 -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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=KlWg00NJ; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbiJaV6A (ORCPT + 99 others); Mon, 31 Oct 2022 17:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiJaV5y (ORCPT ); Mon, 31 Oct 2022 17:57:54 -0400 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B8E140D0; Mon, 31 Oct 2022 14:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1667253474; x=1698789474; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=lrb22HZ6Jnm7ozydurS59fLEB2TfDlJmL+nE6nHtD1o=; b=KlWg00NJzwIfwmIH+Pyqpstpz8GpgLSkSAokvqABg0aDo3WGDXCpCzLb dZXXcrM2nizSL9P5eiWnDpSXApu4mVdd3zaTNoEERy5dW5ZdnXHmCynJT sYxH7DsFMahaHW80eK+EBJHzL0EU3SwCSSqFPmBnTLBVw9SP8Y7tLeqVc w=; X-IronPort-AV: E=Sophos;i="5.95,228,1661817600"; d="scan'208";a="258282981" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-1box-2bm6-32cf6363.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 21:57:50 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-1box-2bm6-32cf6363.us-west-2.amazon.com (Postfix) with ESMTPS id D08A681A6C; Mon, 31 Oct 2022 21:57:47 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 31 Oct 2022 21:57:46 +0000 Received: from 88665a182662.ant.amazon.com (10.43.160.223) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.15; Mon, 31 Oct 2022 21:57:44 +0000 From: Kuniyuki Iwashima To: Catalin Marinas , Will Deacon , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann CC: Akihiro HARAI , Jiri Olsa , Kuniyuki Iwashima , Kuniyuki Iwashima , , , Subject: [PATCH] arm64/syscall: Include asm/ptrace.h in syscall_wrapper header. Date: Mon, 31 Oct 2022 14:57:28 -0700 Message-ID: <20221031215728.50389-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Originating-IP: [10.43.160.223] X-ClientProxiedBy: EX13D23UWC003.ant.amazon.com (10.43.162.81) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748242497295462429?= X-GMAIL-MSGID: =?utf-8?q?1748242497295462429?= Add the same change for ARM64 as done in the commit 9440c4294160 ("x86/syscall: Include asm/ptrace.h in syscall_wrapper header") to make sure all syscalls see 'struct pt_regs' definition and resulted BTF for '__arm64_sys_*(struct pt_regs *regs)' functions point to actual struct. Without this patch, the BPF verifier refuses to load a tracing prog which accesses pt_regs. bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = -1 EACCES With this patch, we can see the correct error, which saves us time in debugging the prog. bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = 4 bpf(BPF_RAW_TRACEPOINT_OPEN, {raw_tracepoint={name=NULL, prog_fd=4}}, 128) = -1 ENOTSUPP Signed-off-by: Kuniyuki Iwashima Acked-by: Andrii Nakryiko --- Note the cited commit only exists in the tip tree for now. https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=9440c42941606af4c379afa3cf8624f0dc43a629 --- arch/arm64/include/asm/syscall_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h index b383b4802a7b..d30217c21eff 100644 --- a/arch/arm64/include/asm/syscall_wrapper.h +++ b/arch/arm64/include/asm/syscall_wrapper.h @@ -8,7 +8,7 @@ #ifndef __ASM_SYSCALL_WRAPPER_H #define __ASM_SYSCALL_WRAPPER_H -struct pt_regs; +#include #define SC_ARM64_REGS_TO_ARGS(x, ...) \ __MAP(x,__SC_ARGS \