From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CBD31FCFF4 for ; Thu, 9 Jan 2025 10:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736417424; cv=none; b=YeBxa9ch711qBzJIeGVQXYLbXfomwpaTOmDOFWjHisdaXE2EmqvmUtbErtks/EYKAug+7EbvukXiJld102n0xDe6zr92jnQG7H2BtCmSUfcILGlIhU51bE+LSCy1UZuFp+DO02MXCqpHiWpkh6xdBBeZN/6yH/2ZAIL8kK4rEgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736417424; c=relaxed/simple; bh=pHkhKMDSQJTTXtJPEN2zXLVIK+2vsmCEiaVRcYpL1iQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MCYqP3hD4OhltvJ8aTnZG+BAuaCxjgjWo4HNH/E/pWVsf9TDMCx6uVhc/8tethJRB+l5tqz+Oka7kbx5WMpf9H70ilu9bz5t8DWPBMLFD6qG4vbYX3redes0uHIbRiiuvt+Tc2IehONzwQBAKGCrCd/lFIxxzeA3LYglsSQiIHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Y7Ss5LpE; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y7Ss5LpE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736417421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0XTKmL6VfPP0yIdlX7n9hhVtqQ75kppf767XWPN+/c0=; b=Y7Ss5LpEwx+M9oSUtRe0hDzfoJzIwzX/WqkafY+ytidi4GUCHUhmk8O+2vlY/FzDJlbFpy dwTYolASmREHSKdyWq4mCRvCxvhCfeUdxMzFS6+u0X/sdjonan/Hq2iqpkthkUp7koqzVz i1E06glUiVDHK5HUt0L3gVRZiFlMXuM= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-dZ5-b7tZPGaAz6hIiu0uhQ-1; Thu, 09 Jan 2025 05:10:16 -0500 X-MC-Unique: dZ5-b7tZPGaAz6hIiu0uhQ-1 X-Mimecast-MFC-AGG-ID: dZ5-b7tZPGaAz6hIiu0uhQ Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D0EF619560B7; Thu, 9 Jan 2025 10:10:13 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.245]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id C066119560AB; Thu, 9 Jan 2025 10:10:10 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 9 Jan 2025 11:09:48 +0100 (CET) Date: Thu, 9 Jan 2025 11:09:44 +0100 From: Oleg Nesterov To: "Dmitry V. Levin" 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: <20250109100943.GA26424@redhat.com> References: <20250107230153.GA30560@strace.io> <20250107230446.GD30633@strace.io> 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: <20250107230446.GD30633@strace.io> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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 ? Oleg.