Re: Process exit notifcation in a kext
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=/J+dNhDVj7gpn2AegN3QO8Y0u1oWXmPQQ1jI4Tkn5Aw=; b=jNszU5WxvljS4NUfBx/zzD12skka7/4ZVns64FAdqoJVAQBZFb5e2V4N4uolTgW23x 2S2eZg8QG4fW8hnqeGKyLjwumhrCmzdB/WYOw5dGMV5HkP7BUTAmzSmRJUz3kEUd9zvV WAif2bArglS70qHU/WB5anrwPrHEBo58Movmc= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=M9GaCELMkFEMa7Ga91k44AtPnYmTTo22luo4OiRcpcihlocjxtlwJWVc8Pkl1pUEzV ssS5Q030P8dh+wvuxTyvSC/+A2dbxXE0+1VwBmq9rbWtJqPGp696o7Q/jOPL5d2ZSzbL u67lW8jov7rnhli13bbVazvqFv0Pv2R6mQ+vM= On Thu, Jun 17, 2010 at 9:24 PM, Terry Lambert <tlambert@apple.com> wrote:
I'd like to ask is this approach is correct: call proc_find(pid) which takes a reference to the proc_t, and then proc_rele(pid) when the exit notification from kqueue comes. This avoids the race, but will the process exit while I am holding a reference to it ? In addition, you have no guarantee that the locking order will happen the way you want it to, i.e. there is a race in acquiring the lock on the process list between you doing the pfind() and the process ID being reused between the time you decide a given PID is interesting to you and the time that the process reference is obtained on a process with that PID, such that it may not be the process you found interesting by the time you have the reference. It's undefined, which is why it's bad to use PID as a unique identifier for security purposes.
True, because I would call pfind() in a callback coming from tcp_input() (and not from a user process). I was hoping for a way to tag a process (like one can tag mbuf's), is this somehow possible ?
-- Terry
Thanks again, Bogdan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Bogdan Harjoc