From owner-freebsd-emulation@freebsd.org Thu Jun 14 14:16:16 2018 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BDD61008263 for ; Thu, 14 Jun 2018 14:16:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B09BB6C857 for ; Thu, 14 Jun 2018 14:16:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTP id w5EEG44j004004; Thu, 14 Jun 2018 17:16:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w5EEG44j004004 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w5EEG4qr004003; Thu, 14 Jun 2018 17:16:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Jun 2018 17:16:04 +0300 From: Konstantin Belousov To: Yanko Yankulov Cc: freebsd-emulation@freebsd.org Subject: Re: two proposed linuxulator fixes + ptrace Message-ID: <20180614141604.GA2493@kib.kiev.ua> References: <20180614101324.GW2493@kib.kiev.ua> <20180614123659.GZ2493@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2018 14:16:16 -0000 On Thu, Jun 14, 2018 at 04:11:52PM +0300, Yanko Yankulov wrote: > > > > For the patch 1, TracePid, can you explain what is the meaning of the > > > > pid reported ? > > > > > > > > The TracerPid is the PID of the process currently ptrace-ing the > > process. > > > TracerPid 0 means no active tracer. So the patch is not semantically > > > correct as it always reports no tracer, but it got the program running. > > Ok, but what is the tracer ? Is it ptrace(2) debugger, or something > > else ? > > > > Yes, any ptrace(2) debugger/truss/strace/whatever. The Linux code is: > > tracer = ptrace_parent(p); > if (tracer) > tpid = task_pid_nr_ns(tracer, ns); I think this should be like PROC_LOCK(p); tpid = (p->p_flag & P_TRACED) != 0 ? p->p_ppid : 0; PROC_UNLOCK(p); sx_slock(&proctree_lock); parent_pid = proc_realparent(p)->p_pid; sx_sunlock(&proctree_lock);