From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9776A2153FA for ; Thu, 9 Jan 2025 10:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.107.17.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736418486; cv=none; b=FyJqC0VaSx05qEnTneuFLrHkroYp/ryPQdvl+MXS2avjQ5PDLu+KfOzambcX2mcRyYYHXOcwHiRlhm7Xdo8as+izo7oRuHkVwbUokWEnKPkgYdFNT0xW03l3DOfVonvAP53DqgxShKZTXL+57yDLkfvUP7R2HnNFEHfRXdZZZ4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736418486; c=relaxed/simple; bh=NK9DMUK6gO+kYibIrAizFOfp254n5nNHm+gIIck2lEY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q2Ysb+pBG79rwOcwKu75+n++og0sYUpeS+Wt9B81EMxBzWoeWaryW747S6ulIxH0LzJ6ajpts5cbJiYjT/Tgqaqga0spfdqLZpKilvm6HqLFR6wlTRT1DzKjM9Js1ETgIaEa3kdIhYUrpKE+eZSSJSD3rWXKASUFBj+8Qv+9ETE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=194.107.17.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 1373072C8F5; Thu, 9 Jan 2025 13:27:56 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 03D1C7CCB3A; Thu, 9 Jan 2025 12:27:55 +0200 (IST) Date: Thu, 9 Jan 2025 12:27:55 +0200 From: "Dmitry V. Levin" To: Oleg Nesterov Cc: Eugene Syromyatnikov , Mike Frysinger , Renzo Davoli , Davide Berardi , strace-devel@lists.strace.io, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op Message-ID: <20250109102755.GA15384@strace.io> References: <20250107230153.GA30560@strace.io> <20250107230446.GD30633@strace.io> <20250109100943.GA26424@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250109100943.GA26424@redhat.com> On Thu, Jan 09, 2025 at 11:09:44AM +0100, Oleg Nesterov wrote: > On 01/08, Dmitry V. Levin wrote: > > > > +static int > > +ptrace_get_syscall_info(struct task_struct *child, unsigned long user_size, > > + void __user *datavp) > > +{ > > + struct pt_regs *regs = task_pt_regs(child); > > + struct ptrace_syscall_info info = { > > + .op = ptrace_get_syscall_info_op(child), > > + .arch = syscall_get_arch(child), > > + .instruction_pointer = instruction_pointer(regs), > > + .stack_pointer = user_stack_pointer(regs), > > + }; > > + unsigned long actual_size = offsetof(struct ptrace_syscall_info, entry); > > + unsigned long write_size; > > + > > + switch (info.op) { > > + case PTRACE_SYSCALL_INFO_ENTRY: > > + actual_size = ptrace_get_syscall_info_entry(child, regs, &info); > > + break; > > + case PTRACE_SYSCALL_INFO_EXIT: > > + actual_size = ptrace_get_syscall_info_exit(child, regs, &info); > > + break; > > + case PTRACE_SYSCALL_INFO_SECCOMP: > > + actual_size = ptrace_get_syscall_info_seccomp(child, regs, &info); > > break; > > OK... but unless I misread this patch, all 3 ptrace_get_syscall_info_xxx() > helpers will do the pointless info->op = PTRACE_SYSCALL_INFO_XXX ? Thanks, your analysis is correct, with this change those assignments become redundant, I'll remove them in the next iteration of this patch. -- ldv