From patchwork Mon Oct 24 17:10:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 9931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp597750wru; Mon, 24 Oct 2022 11:40:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48omLuJRd5KZLk4jJ+XTJxIF26PiSfBor7sXZjxHLGXWrVmzBrJ3DEb80xebLiGg5qTdGM X-Received: by 2002:a17:903:22c1:b0:186:5f78:44c5 with SMTP id y1-20020a17090322c100b001865f7844c5mr25614890plg.16.1666636855256; Mon, 24 Oct 2022 11:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666636855; cv=none; d=google.com; s=arc-20160816; b=t5HZkRNKhdrY6W5SXUcVzFZ/7w1jOkLEAn5BPksppPl9miZ92DpcZk0KNANqda9WyP IUadPi8B5hSq+ALYeI1yhZM71h9s+vUufwkf7KQXSzmNhUWg1zAnemdz3aKMG94cUtz4 CNzJ4pq33r1+SO995RvApmArvcL5z9Hsnk7XVqiuh1/GkIWFK+QRJPEOUbsICkbrXMto HnbDzCk4D+X8jhcZWV7So0OeHcmbxGT7v69HiXQUuZMwxyyePsmMzK+3OWkqASmdGBU3 K3lLLtEy8c+5va51WWbTzmhOOL06ZmoEgupciWo+xgbcnU9ZpjLio3KX7ULwy1ZTwQvc A6XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=xGfm3vLqdme7A5E0vyS+E4k+G5iTckWHeneSgjrt6Us=; b=KZTznlTlg4St/rHkpLDpunwC8CKjD0wzqcMnk8kxiAJon6cxkQtnhTS2/qkCEay9kk OuL/efz8EBUryfkujJP4F9Xpxh2Y9fsFThWoxbjeBACUGxfZPo6phajR3XO/w187hGMn 25CaEj9Au+Q3n/Dzti6RDObIhcRpkBafmsWl3AokqWUAyGOuykD2Gt4EEB8VlJPO7BPG N4ZYfAroc0YQxQ/0qB9H73V82vNe5a6gbJfOvnrNb65s9mjXl3Mfu88h/NFV482HLF39 ovxyylCuXK5W7vkYrlZAPb9KBh1B+Ro2C+sexx+kELATTQvEaye93CcCIIs6DZRatqV3 iLmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UKmarg7x; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x23-20020a633117000000b0043a93738a14si294080pgx.167.2022.10.24.11.40.41; Mon, 24 Oct 2022 11:40:55 -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=@linutronix.de header.s=2020 header.b=UKmarg7x; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbiJXSjn (ORCPT + 99 others); Mon, 24 Oct 2022 14:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbiJXSjJ (ORCPT ); Mon, 24 Oct 2022 14:39:09 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52007B7ECA; Mon, 24 Oct 2022 10:21:26 -0700 (PDT) Date: Mon, 24 Oct 2022 17:10:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666631457; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xGfm3vLqdme7A5E0vyS+E4k+G5iTckWHeneSgjrt6Us=; b=UKmarg7xrPzCAcoEp+bwHWS888Y2NGkmsLTIhizgYRqQ3yZPiiHF8I1CuMmQvXF0uPtkkU cLbUlYmJRN+oM4HWNXq3i0+CZB0h74B3bk48gsry6InceAr69b6cgPCIKSiBb/w+S3kTub /28XeC6D14gmQjexuCu3LZ86rnBfCCVBj8nblKU0OFrH15+oIeqsOgqzu2R6Z2+R5fBRyE FUxM3te0nwG3ZYLh7TkNtrWimUZmbwqFKmTQpIGsQGWLpqBaYa6Ms906yCltFUdqzMAZUi GpCXv8u0grRWg+2QYvlUPWD52JluOi8XUtvjcSN5z8vhUujPdXSgQR6XbhZf8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666631457; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xGfm3vLqdme7A5E0vyS+E4k+G5iTckWHeneSgjrt6Us=; b=xtGsC+xq2tYNrwJEDZZ2euO/az4mPKT84I09CS6MNlNNkVmsn4eiB/REMA3+NP4GKNSYdE ghzTm+JYB3uScYBQ== From: "tip-bot2 for Jiri Olsa" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/syscall: Include asm/ptrace.h in syscall_wrapper header Cc: Akihiro HARAI , Jiri Olsa , Borislav Petkov , Andrii Nakryiko , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221018122708.823792-1-jolsa@kernel.org> References: <20221018122708.823792-1-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <166663145589.401.720002161640534427.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1747595407078805741?= X-GMAIL-MSGID: =?utf-8?q?1747595407078805741?= The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 9440c42941606af4c379afa3cf8624f0dc43a629 Gitweb: https://git.kernel.org/tip/9440c42941606af4c379afa3cf8624f0dc43a629 Author: Jiri Olsa AuthorDate: Tue, 18 Oct 2022 14:27:08 +02:00 Committer: Borislav Petkov CommitterDate: Mon, 24 Oct 2022 17:57:28 +02:00 x86/syscall: Include asm/ptrace.h in syscall_wrapper header With just the forward declaration of the 'struct pt_regs' in syscall_wrapper.h, the syscall stub functions: __[x64|ia32]_sys_*(struct pt_regs *regs) will have different definition of 'regs' argument in BTF data based on which object file they are defined in. If the syscall's object includes 'struct pt_regs' definition, the BTF argument data will point to a 'struct pt_regs' record, like: [226] STRUCT 'pt_regs' size=168 vlen=21 'r15' type_id=1 bits_offset=0 'r14' type_id=1 bits_offset=64 'r13' type_id=1 bits_offset=128 ... If not, it will point to a fwd declaration record: [15439] FWD 'pt_regs' fwd_kind=struct and make bpf tracing program hooking on those functions unable to access fields from 'struct pt_regs'. Include asm/ptrace.h directly in syscall_wrapper.h to make sure all syscalls see 'struct pt_regs' definition. This then results in BTF for '__*_sys_*(struct pt_regs *regs)' functions to point to the actual struct, not just the forward declaration. [ bp: No Fixes tag as this is not really a bug fix but "adjustment" so that BTF is happy. ] Reported-by: Akihiro HARAI Signed-off-by: Jiri Olsa Signed-off-by: Borislav Petkov Acked-by: Andrii Nakryiko Cc: # this is needed only for BTF so kernels >= 5.15 Link: https://lore.kernel.org/r/20221018122708.823792-1-jolsa@kernel.org --- arch/x86/include/asm/syscall_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h index 59358d1..fd2669b 100644 --- a/arch/x86/include/asm/syscall_wrapper.h +++ b/arch/x86/include/asm/syscall_wrapper.h @@ -6,7 +6,7 @@ #ifndef _ASM_X86_SYSCALL_WRAPPER_H #define _ASM_X86_SYSCALL_WRAPPER_H -struct pt_regs; +#include extern long __x64_sys_ni_syscall(const struct pt_regs *regs); extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);