From patchwork Thu Oct 10 11:33:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13829997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D07FCF11D2 for ; Thu, 10 Oct 2024 11:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8kAN7grhcUpbCDFoKucfYZVBg7IClr2vppXay/MPoLQ=; b=RMlrRCCIcZHX1sSauSUw2uswo4 u81wbuZJQh4YGL9tp2XCD2BshsbdiYttd5fWG7WMEDkivSUa2TLJpGVuHAKr3JbpumWWKPluPVw1c a0XLwfQ9URtA0SZSHH3NT5VTmQvgwYYJJ01EEA6d8jXW1NbGpaXFckTb3RgCv5jE0NFoR3llVhxdM 5kN3ROUwDVga+1q7J3F8enUYeYu6TyVZ3M5IBk7dWG6RyaWFAq7BuhoUKzBgGuUDwjqWUvQ8aP7VA KiO2UvuzKOAJtnyIdK3j3CNyhe6spmvKCmdCAQX2zFCf5YZbyHeAovsVXYIc7StqnBpJOQUkV/LKC gwIV1j6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syrdD-0000000CbEE-2Ajz; Thu, 10 Oct 2024 11:46:59 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syrQd-0000000CYDZ-22Ty for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 11:34:02 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a9943897c07so114204266b.3 for ; Thu, 10 Oct 2024 04:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728560037; x=1729164837; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8kAN7grhcUpbCDFoKucfYZVBg7IClr2vppXay/MPoLQ=; b=PHVG2SbTJfEfadU0n8p/Fvmd0j5+HmR9Fi9A41NJP4Af/gTZuciZNtdb/ALPpo3ND/ 8feT5dqE+6N6Hr8jjrFHk7MFieqwd+Epg5C8Yy4C69sUZ90A+3SmPCuttmHSuDesigW2 iqTOBLCa5jyrESLsRocM1ZfZdIOdZlRTnW5Nd+R5+/wRYitArpKdXhsF2fFwvsEKkeCF s1Cdlynd7inssVXEymEIunLFd4JPEENYxNM3is3C0/LcKXkKFXSuu0W5DPcw4oepKkgx 8N3/fF6tX30QNiG1lVO5i8K+hzu2VDiQGONXY07kn9USDzppT/mZOkBQZg8VNDPEfG+a qMRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728560037; x=1729164837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8kAN7grhcUpbCDFoKucfYZVBg7IClr2vppXay/MPoLQ=; b=cvcH4LMO+gww772xIK1001iDA5yVmfnnmtI8lp3fbhDo9y99RgU4bTzXU090HnYECt 6AcSfitY/1qeqTQ6o/cgJ4P/qgex4ivj9kbuRdubzdYQpp3ixmqFzOtIPIZnu4Oiba1i CwwGrL8cZT54xz2BjltSi8kcOxYXarI1/+gdYyijiJEWHvuQAGS0wDEYKA3YFoeW2IyP iimf50GONYwgeKFDPVaEoiIGu4o2y608frnmA6cpnw6jw+kREJ1mE7gG1ax2aD+60/QG cvr7HJY8ph2BvxoQz8tZzK9WtyjX6BfRlXYlseYoxCD5u2BoDN1/7qyunLwf7WPBmom8 jTFg== X-Gm-Message-State: AOJu0YzdA8VEAv/UQvNHAKN5jffMbUoN1zaiGF/ZLoydrT08JtNDZOIb cS6/oQkQzaiKGvxrTKLAWg6KDyGEVrs8vCWgvshBCemneMEpFm6/NTmmKVvMOjE= X-Google-Smtp-Source: AGHT+IFukWWZ+4l7WL4Af/FV3llg/yA4aFqolHoqsZkfDC6Tj/Nvfup8eye8T7q53dHtZfNUaRUeAQ== X-Received: by 2002:a17:907:e2c1:b0:a8d:3085:a7b1 with SMTP id a640c23a62f3a-a998d205f31mr531467266b.38.1728560037608; Thu, 10 Oct 2024 04:33:57 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a7f25406sm77619066b.69.2024.10.10.04.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 04:33:56 -0700 (PDT) From: Linus Walleij Date: Thu, 10 Oct 2024 13:33:46 +0200 Subject: [PATCH RFC 08/28] ARM: entry: Move trace entry to C function MIME-Version: 1.0 Message-Id: <20241010-arm-generic-entry-v1-8-b94f451d087b@linaro.org> References: <20241010-arm-generic-entry-v1-0-b94f451d087b@linaro.org> In-Reply-To: <20241010-arm-generic-entry-v1-0-b94f451d087b@linaro.org> To: Oleg Nesterov , Russell King , Kees Cook , Andy Lutomirski , Will Drewry , Frederic Weisbecker , "Paul E. McKenney" , Jinjie Ruan , Arnd Bergmann , Ard Biesheuvel , Al Viro Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_043359_614757_6D448F35 X-CRM114-Status: GOOD ( 15.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This moves over the code entering into tracing into the C syscall invocation code. As syscall_trace_enter() will provide the current syscall number from the regs we need not provide the syscall number to the invocation function any more. Signed-off-by: Linus Walleij --- arch/arm/include/asm/syscall.h | 2 +- arch/arm/kernel/entry-common.S | 6 +----- arch/arm/kernel/syscall.c | 5 ++++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h index 1d21f26ecf51..66067d165ba3 100644 --- a/arch/arm/include/asm/syscall.h +++ b/arch/arm/include/asm/syscall.h @@ -20,7 +20,7 @@ extern const unsigned long sys_call_table[]; int invoke_syscall(void *table, struct pt_regs *regs, int scno, void *retp); -int invoke_syscall_trace(void *table, struct pt_regs *regs, int scno, void *retp); +int invoke_syscall_trace(void *table, struct pt_regs *regs, void *retp); static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 77801d039b5f..3cfc6d952ff9 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -292,13 +292,9 @@ ENDPROC(vector_swi) * context switches, and waiting for our parent to respond. */ __sys_trace: - add r0, sp, #S_OFF - bl syscall_trace_enter - mov scno, r0 - mov r2, r0 @ scno into r2 add r1, sp, #S_R0 + S_OFF @ pointer to regs mov r0, tbl - badr r3, __sys_trace_return + badr r2, __sys_trace_return bl invoke_syscall_trace cmp r0, #-1 bne __sys_trace_return diff --git a/arch/arm/kernel/syscall.c b/arch/arm/kernel/syscall.c index d1259c6d2805..815312f7b254 100644 --- a/arch/arm/kernel/syscall.c +++ b/arch/arm/kernel/syscall.c @@ -19,8 +19,11 @@ __visible int invoke_syscall(void *table, struct pt_regs *regs, int scno, void * int invoke_syscall_trace_asm(void *table, struct pt_regs *regs, int scno, void *retp); -__visible int invoke_syscall_trace(void *table, struct pt_regs *regs, int scno, void *retp) +__visible int invoke_syscall_trace(void *table, struct pt_regs *regs, void *retp) { + int scno; + + scno = syscall_trace_enter(regs); if (scno == -1) return -1;