Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1209600imj; Sun, 17 Feb 2019 00:14:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IZD4DHWLO26YCK2U/a+W9HtLq8cisgZl11gcJh1s7SwEs+LvQ8l2Y9iOGQmS3t05JR5uh9u X-Received: by 2002:a17:902:e01:: with SMTP id 1mr18646083plw.251.1550391268250; Sun, 17 Feb 2019 00:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550391268; cv=none; d=google.com; s=arc-20160816; b=MA8dlaqumvfk7nhCkq2tUKSUjlfXGP1dh/Ehs6PGzynaRWyok+/BZahsxZjDL9V89d USMeh1CLlsVRWg1YrkMKW3EsD9s3wW9EK7nyjs3UQRQxbruEgYQZXbawbWqlBTOIYiDB CMN/isLECAVFf2OEsz8kqaSsjaUMHGfD65iw+oLCQDJ+KeW8SLWw99DoYnhh9kpXHEwo LPi/NpXG+ruQNTIevlV9D9QApjBF9vUmFr6t2mhKHwV8xj94rLhBaf2me1VXYhsOma2S TV86dkW7JzjRN0LN+U3BXVdiMSLRXf9eSf2xAYPBRcCJ9SFdqquxEAXBDKTuNFlwuakI A2SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:cc :autocrypt:openpgp:subject:from:to; bh=os8s9a+LpYT50RY40lE9lLV1HSPOEavupAGRBYiOXzk=; b=InMyca4TvO+5bbmYtD3YZoFWxVOHt69v4OKsqzhNls92iqEBVdcu+kwpjP9m4j5nkz CW/U/BYpwzvo4PNr2vexPdunFcyl2PItkHwJgZ0SeuDutCIKdKAPoS3ZVRWf9wVP/ro+ 6Sh2GnGX5kq3Ees6CZ3zovabK2FRu9C0OzfkHh/4Lff5xyvMBV9A5REhiO3b/WkFPL38 AXZUZRUxaSNRK2VQgC89DkYcrX/4g8G0rleb8YkQIORKcejREN/C4lB4UeE1EXTj6vFE VspNebuKLW+ZZww901fgInmZhVyusD/OtFG3kLzvBZ8yGNnKKYHKaxhQ3sqlxsARAJIo s5DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p36si9951357pgb.432.2019.02.17.00.14.11; Sun, 17 Feb 2019 00:14:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbfBQByi (ORCPT + 99 others); Sat, 16 Feb 2019 20:54:38 -0500 Received: from mail.grenz-bonn.de ([178.33.37.38]:51110 "EHLO mail.grenz-bonn.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726220AbfBQByi (ORCPT ); Sat, 16 Feb 2019 20:54:38 -0500 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Sat, 16 Feb 2019 20:54:37 EST Received: from [192.168.1.100] (212-51-139-180.fiber7.init7.net [212.51.139.180]) by ks357529.kimsufi.com (Postfix) with ESMTPSA id 2EA5978B72; Sun, 17 Feb 2019 02:47:29 +0100 (CET) To: linux-kernel@vger.kernel.org From: =?UTF-8?Q?Niklas_Hamb=c3=bcchen?= Subject: ptrace() with multithreaded tracer Openpgp: preference=signencrypt Autocrypt: addr=mail@nh2.me; keydata= mQINBFZQegIBEADD2C+ODuFxK9XAQQqbP84M7y6gRDMIaFxqeT56g/pbe/wNjKATUQhJvaVJ /WbZ900KjMe8eo4Lg3uLbd6OxR2wb4OMkA7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d6 Srcvds4SgNok5ZqSPm4uFokPIXtnnnfS625chKyQpEjG2nvY7v26k5bnZe1fMWQ/1lKcTKNE sittu+pUu0QAouxvf58uLCyJMWGalw//Zqlmjeo4d4XlAYhZXVcxC3clHfGUYTDv/rbIFnvR b+Uf28TpEOtud14JK6+zDqili1YU1Ij9gRe+/1uSUs0wRi5MY96MM0bvJnKiX5/SAtHcuxw9 Kz+lJxN5L9sMpVPAwoe6JIqUTPpye/Jue831SZfRn3mfzcYb/SF5Hwdgywu4e1eRpVjNQBH1 MSUX/8GzZ+V4LhfZ40sxCwx5Z9YVaV2cSqgYqxUvIF5+vu6r40zWvrWP027+TpVL18cKjvMK VF/608uTmzmBHom5bQMcxJSdFMTngJg/Nln7XGuTJqtO1L6GqBq0MQHldRJKwkzlVrVkz+Z8 bN+kQkhVCW5H8i7uiFRUEk7Pz3Gx2MLyiPjuTBTc0VRPH1WRzW6R4Ictrf1fz6CT4/M4dFWt hUV84M6gI8jgK4pbW+bY4+8jObdduY4usqleR6y7mm31VV+dJLVqLOT7j4xhXfdojXXo9c9y wEPK29lwsDGETZvU8Om84L091W3W/+PEKEfAF9d3/Y2D6Xa49/Aj6cVJkSJu1cuAsEw8tWBu jWF7tAn11z6SXVw9OfK60nT5mG+3Tf0cL5npuWcAqpZRlOyN/0HGlW135QK8VzG6y7mnHmwv J1QPfRaxBQjCJ2JnQdFcfQIxI0nfqF64vNzenQrtZSGNDLgEvg1cdLOrXVoRHubYarA= Cc: cleverca22@gmail.com Message-ID: <48bb7c89-abb9-1e88-fee3-fb42d4032d12@nh2.me> Date: Sun, 17 Feb 2019 02:47:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, it would be awesome if somebody in the know could confirm or refute a suspicion on ptrace() that we have. The man page says: Attachment and subsequent commands are per thread: in a multiā€ threaded process, every thread can be individually attached to a (potentially different) tracer, or left not attached and thus not debugged. Therefore, "tracee" always means "(one) thread", never "a (possibly multithreaded) process". While the first sentence "Attachment ... [is] per thread" is quite general, the rest talks only about the multi-threadedness of the *tracee*. What about multithreaded *tracers*? We suspect (and observe program behaviour that supports this) that having one thread pA_t1 in a process A become the tracer of some tracee thread pB_t1, and then a different thread of A, pA_t2 running a `ptrace(pB_t1, ...)` is illegal and results in `ESRCH`. Is this statement in true in general, or are there nuances? Thanks, Niklas PS: We'd be happy to contribute these details to the man page based on an answer :)