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 E963C15990C for ; Wed, 15 Jan 2025 16:38:45 +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=1736959127; cv=none; b=NP0YGOdMLQuKycu1LRndIIQOc8a1jvVe6R2VW1lkfFsVltHGoWNdkdDEk4vUuNYsp1fBi5Y2+itmyFjS1QC4ULxG7Kb/5IbJoD6e47JqLUd0IaukSBBA1NN0Rd2BAUtJE594+TUeJ2lKPFlw3ljka0tbbWctn3xaGdi+MWWd+nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736959127; c=relaxed/simple; bh=WhTPuMtPUGlEUfb47H351mVC8OQPPJnO2AflZxxVxoI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BQcAfQVA5ZcTVW3z17EKhYyN/a2RS4GlVHUI5jGKJJO7/OtUFTeSwycw1LNl//CpUBoP3VeAlPIXzeBa6nn4RVXusCA71Eyg4nYa9qN569lQwRB+tsU9mIOxsZYGEXn4qFdSoD49/eLyw1gIglFx/I/kIQMOklFq+9GJwkwebSk= 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=flnuhgfg; 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="flnuhgfg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736959124; 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=ERPyuR9xk9MAs0lvW+jsCztNMlwAElOZ9fxL6fdKsBY=; b=flnuhgfggsanDhiOUF1UTjrodfVwcx/iy3OoA+TxsLjsFP8yAWEpRsCYoOF1QlEeej2V2G IBbQybTjD4l5YLrAityxq5tAPmvEPvHPBKW3lHxLDDgzHrQ21f3fNuyHZLKYnCeKXWLsqa ieSJuPKccNYWNINsnRXJTVWA9TGGoAw= Received: from mx-prod-mc-05.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-326-r8i9OhHvMmGonxnPsTIjPA-1; Wed, 15 Jan 2025 11:38:41 -0500 X-MC-Unique: r8i9OhHvMmGonxnPsTIjPA-1 X-Mimecast-MFC-AGG-ID: r8i9OhHvMmGonxnPsTIjPA 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C94BB1955F69; Wed, 15 Jan 2025 16:38:39 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.39]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id E652E19560AB; Wed, 15 Jan 2025 16:38:35 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 15 Jan 2025 17:38:14 +0100 (CET) Date: Wed, 15 Jan 2025 17:38:09 +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, linux-api@vger.kernel.org Subject: Re: [PATCH v2 6/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO request Message-ID: <20250115163809.GC11980@redhat.com> References: <20250113170925.GA392@strace.io> <20250113171208.GF589@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: <20250113171208.GF589@strace.io> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Dmitry, I can't review the non-x86 changes in 1/7 - 4/7. As for this and the previous patch I see nothing bad after a quick glance. Just I have some concerns about the "future extensions", I'll write another email tomorrow. In particualar, I personally hate the very idea of copy_struct_from_user/check_zeroed_user ;) On 01/13, Dmitry V. Levin wrote: > > +ptrace_set_syscall_info_entry(struct task_struct *child, struct pt_regs *regs, > + struct ptrace_syscall_info *info) > +{ > + unsigned long args[ARRAY_SIZE(info->entry.args)]; > + int nr = info->entry.nr; > + int i; > + > + if (nr != info->entry.nr) > + return -ERANGE; > + > + for (i = 0; i < ARRAY_SIZE(args); i++) { > + args[i] = info->entry.args[i]; > + if (args[i] != info->entry.args[i]) > + return -ERANGE; > + } > + > + syscall_set_nr(child, regs, nr); > + /* > + * If the syscall number is set to -1, setting syscall arguments is not > + * just pointless, it would also clobber the syscall return value on > + * those architectures that share the same register both for the first > + * argument of syscall and its return value. > + */ > + if (nr != -1) > + syscall_set_arguments(child, regs, args); Thanks, much better than I tried to suggest in my reply to V1. But may be if (syscall_get_nr() != -1) syscall_set_arguments(...); will look a bit more consistent? Oleg.