From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B234C04E30 for ; Mon, 9 Dec 2019 20:46:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DBA02071E for ; Mon, 9 Dec 2019 20:46:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P8GupNdf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726860AbfLIUqt (ORCPT ); Mon, 9 Dec 2019 15:46:49 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46623 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726354AbfLIUqs (ORCPT ); Mon, 9 Dec 2019 15:46:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575924407; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YvGxejde19Gce3IT94gbjW52qT1tnhP9TIAUg/7+ybA=; b=P8GupNdf2tOVwc+jG/MFTaBF2AUWHhDjHpHQ6cjD9oicuBx1nOjMspzPnJat4zfDU0sAVi ouXvt0TMgAGfScRWsUuu+SfJKI5lXSvLzHC6q5m0ybzsl6+Z2RJ1sF3T3mD84KIcFooyY9 wzNx+Qjj6NUi/qfKr8dfn7pKzAXFNjw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-TMQKf60QPd6sKPR1BUnflg-1; Mon, 09 Dec 2019 15:46:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B6431856A60; Mon, 9 Dec 2019 20:46:40 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (ovpn-204-235.brq.redhat.com [10.40.204.235]) by smtp.corp.redhat.com (Postfix) with SMTP id 0219B60BE1; Mon, 9 Dec 2019 20:46:36 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 9 Dec 2019 21:46:39 +0100 (CET) Date: Mon, 9 Dec 2019 21:46:35 +0100 From: Oleg Nesterov To: Christian Brauner Cc: Sargun Dhillon , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, tycho@tycho.ws, jannh@google.com, cyphar@cyphar.com, luto@amacapital.net, viro@zeniv.linux.org.uk Subject: Re: [PATCH v2 4/4] samples: Add example of using PTRACE_GETFD in conjunction with user trap Message-ID: <20191209204635.GC10721@redhat.com> References: <20191209070646.GA32477@ircssh-2.c.rugged-nimbus-611.internal> <20191209192959.GB10721@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: TMQKf60QPd6sKPR1BUnflg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 12/09, Christian Brauner wrote: > > >We can > >add PTRACE_DETACH_ASYNC, but this makes me think that PTRACE_GETFD has > >nothing > >to do with ptrace. > > > >May be a new syscall which does ptrace_may_access() + get_task_file() > >will make > >more sense? > > > >Oleg. >=20 > Once more since this annoying app uses html by default... >=20 > But we can already do this right now and this is just an improvement. > That's a bit rich for a new syscall imho... I agree, and I won't really argue... but the changelog in 2/4 says =09The requirement that the tracer has attached to the tracee prior to the =09capture of the file descriptor may be lifted at a later point. so may be we should do this right now? plus this part =09@@ -1265,7 +1295,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, = unsigned long, addr, =09=09} =09=20 =09=09ret =3D ptrace_check_attach(child, request =3D=3D PTRACE_KILL || =09-=09=09=09=09 request =3D=3D PTRACE_INTERRUPT); =09+=09=09=09=09 request =3D=3D PTRACE_INTERRUPT || =09+=09=09=09=09 request =3D=3D PTRACE_GETFD); actually means "we do not need ptrace, but we do not know where else we can add this fd_install(get_task_file()). Oleg.