Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1561795yba; Thu, 4 Apr 2019 13:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNB8hHFf829VOqj2vkMOFnEgHPKLRb+O4H82oGoRqa4dW48VDf1ILGeGEB1Ow2fyRkVJBX X-Received: by 2002:a63:3287:: with SMTP id y129mr7870834pgy.9.1554409264114; Thu, 04 Apr 2019 13:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554409264; cv=none; d=google.com; s=arc-20160816; b=bi4e+4dat4MTZM0FXeQYyQOesVZStS98Bsg1+G5QC0K+TwyLAY8jVX0zCAtzO4yxfZ ggEUxtiV547EtfPon1WwSF12HktyQuQ2dJoFFQPZGZYlpp+1c/pkFSrbleQ0YOuKdUYn uCkJ8j8VFVJziIFuEl1KH/nilmfEHARj56HPsgueh9WCGU06fbYR24bq3pa87N7dP+cf 8yD1QDmuef4ANUcjVRq1H4b6jxqSIilZZBMYcftPsmgW71aA6lnjEo8C9a3J4a8myab4 e+MU2wr1E4aqpA63+gmRvN/9/3d+TcT7E1F6LvlVVGczkJj/B4nkPULx/mkS5olTVB1j S26Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EX8alMf2hgUqXHwlScJydqvtad7DOTQ9eOJ4gfeHeIE=; b=onaEQCJCOQErjU18wSNL2U+JRUkPbuYc4ct/fULZpUw4k8CGtztqOu89YjS0ahNk6U 1TKdjyfy+ySonBRtTIVphxe3UXCqpv9MUNw72blJTY8w/Zr8/Ms635vdidSe+X27I2Iq yM9xtE9tg0j4fAwuH1Od3PeFC6ygJqzcTBXtiQHeC18yR3TfRk/Cj9YzT0i8VGqaL2Rl 73TFZ3j0leC3cNE8twALqSAmEfDqOOKHvtc1LwJdbMdPjItj2QPmqbyDpq2u2T9KIQSb m9QTOLTsfnGjgCXH/By2O759KbGW9iX7qerZWt398yigoDdWyfQ1oSpyaeXIaP7Fg9Pw sqPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c31si16786241pgm.490.2019.04.04.13.20.48; Thu, 04 Apr 2019 13:21:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729657AbfDDSSy (ORCPT + 99 others); Thu, 4 Apr 2019 14:18:54 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:54046 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727562AbfDDSSx (ORCPT ); Thu, 4 Apr 2019 14:18:53 -0400 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id DB43B72CC8C; Thu, 4 Apr 2019 21:18:49 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id C30037CCE4F; Thu, 4 Apr 2019 21:18:49 +0300 (MSK) Date: Thu, 4 Apr 2019 21:18:49 +0300 From: "Dmitry V. Levin" To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Andy Lutomirski , Roland McGrath , Oleg Nesterov , linux-arch@vger.kernel.org, Peter Zijlstra , Thomas Gleixner , "Gustavo A. R. Silva" , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Dominik Brodowski , Andy Lutomirski , Kees Cook , "Eric W. Biederman" , Palmer Dabbelt , Dave Martin , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, uclinux-h8-devel@lists.sourceforge.jp, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args Message-ID: <20190404181849.GA8711@altlinux.org> References: <20190401134104.676620247@goodmis.org> <20190401134421.442323029@goodmis.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <20190401134421.442323029@goodmis.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" >=20 > After removing the start and count arguments of syscall_get_arguments() it > seems reasonable to remove them from syscall_set_arguments(). Note, as of > today, there are no users of syscall_set_arguments(). But we are told that > there will be soon. But for now, at least make it consistent with > syscall_get_arguments(). >=20 > Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org FWIW, you can add Reviewed-by: Dmitry V. Levin =20 There are two places listed below where I'd prefer to see more readable equivalents, but feel free to leave it to respective arch maintainers. > diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/sy= scall.h > index 89a6ec8731d8..671ebd357496 100644 > --- a/arch/nds32/include/asm/syscall.h > +++ b/arch/nds32/include/asm/syscall.h > @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task= , struct pt_regs *regs, > * syscall_set_arguments - change system call parameter value > * @task: task of interest, must be in system call entry tracing > * @regs: task_pt_regs() of @task > - * @i: argument index [0,5] > - * @n: number of arguments; n+i must be [1,6]. > * @args: array of argument values to store > * > - * Changes @n arguments to the system call starting with the @i'th argum= ent. > - * Argument @i gets value @args[0], and so on. > - * An arch inline version is probably optimal when @i and @n are constan= ts. > + * Changes 6 arguments to the system call. The first argument gets value > + * @args[0], and so on. > * > * It's only valid to call this when @task is stopped for tracing on > * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUD= IT. > - * It's invalid to call this with @i + @n > 6; we only support system ca= lls > - * taking up to 6 arguments. > */ > void syscall_set_arguments(struct task_struct *task, struct pt_regs *reg= s, > - unsigned int i, unsigned int n, > const unsigned long *args) > { > - if (n =3D=3D 0) > - return; > - > - if (i + n > SYSCALL_MAX_ARGS) { > - pr_warn("%s called with max args %d, handling only %d\n", > - __func__, i + n, SYSCALL_MAX_ARGS); > - n =3D SYSCALL_MAX_ARGS - i; > - } > - > - if (i =3D=3D 0) { > - regs->orig_r0 =3D args[0]; > - args++; > - i++; > - n--; > - } > + regs->orig_r0 =3D args[0]; > + args++; > =20 > - memcpy(®s->uregs[0] + i, args, n * sizeof(args[0])); > + memcpy(®s->uregs[0] + 1, args, 5 * sizeof(args[0])); > } A shorter and slightly more readable equivalent of the last memcpy is memcpy(®s->uregs[1], args, 5 * sizeof(args[0])); > diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/sysc= all.h > index ee0b1f6aa36d..59c3e91f2cdb 100644 > --- a/arch/s390/include/asm/syscall.h > +++ b/arch/s390/include/asm/syscall.h > @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_= struct *task, > =20 > static inline void syscall_set_arguments(struct task_struct *task, > struct pt_regs *regs, > - unsigned int i, unsigned int n, > const unsigned long *args) > { > - BUG_ON(i + n > 6); > + unsigned int n =3D 6; > + > while (n-- > 0) > - if (i + n > 0) > - regs->gprs[2 + i + n] =3D args[n]; > - if (i =3D=3D 0) > - regs->orig_gpr2 =3D args[0]; > + if (n > 0) > + regs->gprs[2 + n] =3D args[n]; > + regs->orig_gpr2 =3D args[0]; > } A shorter and slightly more readable equivalent of the loop is while (--n > 0) regs->gprs[2 + n] =3D args[n]; --=20 ldv --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJcpkqJAAoJEAVFT+BVnCUIkZ4QAOj5yCToMhv0yo7mY8ZiYOeM 4W75B2oenIbr0XPjODdE7bJ8Zz2aWXIy8ivTN5TkHPrhXeqD/+TrvHc8SIlGGZaQ RCkrjp8yN0vTWNQQyZ0QrAu27Z0bLMcM2RMTHYFHIKtIN9y/6FqOy+KFHBX+XTHs wRtrmxXaOg6tFsrw5ljEZJEPn4hiTStgTUNuUWfFHJ45xkLm/Xl1xy5I+q0vSTRe 2TVfqiAgRND0rwyLCQnc6Q9A+eG/tojEI/yBeaePhNVc2aT8kjbopkH9ppxMf83s FR+Hy0IcJpSUEmNDPzFJ5dR4oTXVXSgxsVacQLbI1cYXZmFbe4kbmCArmS40Z1ID ETWm8m9repzEYVjVCGXNcPeZHwY6qm5V8TNSJYkuNdYLO/G5ViBSjNe/4EPp7Jsy U63M5VuKOWMfEW5JL3KV17+xKjQ8ehpeBWo9+CYRQlbjlmDfjL9CPqC+W0qWUcQn ID3Ifll16M/ERzBRky4+XTlNHBRIUnKsolQY+b8V9WL7F7FZAbi0EGOSBAiLIcYd f2JeixCHd3ax9okr0/3F3O0TWxRMfaId+9yxz8dUJUcDZ/QuMMzymnKYrmXN0Sug TwaWCVXiIhl3jYCF+AbJNA0dz72Jj4rz4PzQChRwagZEa5bGCRuzgU931k7xnobH JOoCPu0p7CEMVSeyAENw =xrhw -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--