From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10381ED8 for ; Wed, 24 Jan 2024 00:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706054955; cv=none; b=Rq86iXr7RVteHP4fm1HgQwIOzuuO4WnW/wtkmDw0tt/csMZj5XsExw4mPVscQbiqzIC9CXFG3DQRA2gukc/L5uBPo8FpuQjpkBZ2RrfkiRFb3gtcJNrUKzZhmtTvIdYop2gOoUWe6jsiAZ5mZ66eVWaNWNWaTZWR3NmDsaGvcIU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706054955; c=relaxed/simple; bh=JUZ8e8sDxBYjrwvOx1r1mk2i3gdTETSMbfB/THjmzhk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Bxs/+0Ls0qM2gj8vOacmJM8DgQRC6xTSWCC20nWBHSszMmBjcSRhpw7hETz2WOqqxdwqoG58BBBQ7FoZRJfgKg/dFT9h0CMSoWHcki2fqAQs+4sWjiVwBbZhvcsNBjO9hNwOo1tFDtQbzn0eYFS0/rVZkUTaMzjxC+7SHC+sHd0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=eJmZ88BT; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eJmZ88BT" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6d9b13fe9e9so3983518b3a.2 for ; Tue, 23 Jan 2024 16:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706054953; x=1706659753; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fi/zj5voHDPYKB6Z7ghbg+VPHgNO2bSCRicH9ZX7KmE=; b=eJmZ88BTtH/btdvJOfUcfeKA+WPdJIGPN4SvCnSXe941tLk7Hq58c76rGyjn5IgIQE C5EnI96TD6twb3v6PFGBvhBBaLC7lPA3bFd/9En9lv+3SmHi8GOg9B7iLbaroXfYKx+w QHrYC4slkfd4k3Hrzc0FaErgt2rc9wuZREfXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706054953; x=1706659753; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fi/zj5voHDPYKB6Z7ghbg+VPHgNO2bSCRicH9ZX7KmE=; b=rTqlLKNZiZOVPBV5AD5uzCVBv63a9lyGa4nlgIXRdOeDBeTTAljSjkDS7EybxZrkPy aNSwqtcJtwg743MyDThV2XD5vxD+DgYWvjduSY4atexu9wqjm5w4cSAqN0e3kY5exPi/ uMcHqvEGxe4FwCKxUvbJvGlbyqpqvEM6IlzQp2vR2IP9iC6HCfF5oNkihlfGM0GM6x+T 69kNMwraNCre9OSxf6yoDnbqBScnG1XtfA3gXsG1xv6dToXz3A9YdUtHXyLNQe51nlny GBItPzBNxgIoW5ActRSPOrtKvTs9+RbMVKNAmzDg2fyvBUKx22jJO+JO8c96z0M8EHYM TTQA== X-Gm-Message-State: AOJu0Yw3pbdIzEuxEv+ditFrLh5KFzvFQRevFPHJPS4eJF8sCKYB41z2 k9ztMVnIaRpjqBATfTwnlpraMs8UEBazcp93+7MLSOyDABvXUr7w11hvMlu1yg== X-Google-Smtp-Source: AGHT+IF/Rcc9ZWVa1OawRmGE1bBUza9XGJben23P16mFFKh9P3lRowBvA2V6yqh/hwNbfps8sMV1fg== X-Received: by 2002:a05:6a00:138b:b0:6dd:8891:81ef with SMTP id t11-20020a056a00138b00b006dd889181efmr407925pfg.43.1706054953404; Tue, 23 Jan 2024 16:09:13 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id r22-20020aa78456000000b006dd7f7b880bsm1841242pfn.133.2024.01.23.16.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 16:09:12 -0800 (PST) Date: Tue, 23 Jan 2024 16:09:12 -0800 From: Kees Cook To: Bernd Edlinger Cc: Oleg Nesterov , Alexander Viro , Alexey Dobriyan , Andy Lutomirski , Will Drewry , Christian Brauner , Andrew Morton , Michal Hocko , Serge Hallyn , James Morris , Randy Dunlap , Suren Baghdasaryan , Yafang Shao , Helge Deller , "Eric W. Biederman" , Adrian Reber , Thomas Gleixner , Jens Axboe , Alexei Starovoitov , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, tiozhang , Luis Chamberlain , "Paulo Alcantara (SUSE)" , Sergey Senozhatsky , Frederic Weisbecker , YueHaibing , Paul Moore , Aleksa Sarai , Stefan Roesch , Chao Yu , xu xin , Jeff Layton , Jan Kara , David Hildenbrand , Dave Chinner , Shuah Khan , Zheng Yejian , Elena Reshetova , David Windsor , Mateusz Guzik , Ard Biesheuvel , "Joel Fernandes (Google)" , "Matthew Wilcox (Oracle)" , Hans Liljestrand Subject: Re: [PATCH v14] exec: Fix dead-lock in de_thread with ptrace_attach Message-ID: <202401231555.59B7EDBB2@keescook> References: <20240116152210.GA12342@redhat.com> <20240117163739.GA32526@redhat.com> <202401221328.5E7A82C32@keescook> Precedence: bulk X-Mailing-List: linux-kselftest@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: On Tue, Jan 23, 2024 at 07:30:52PM +0100, Bernd Edlinger wrote: > - Currently a non-privileged program can potentially send such a privileged > tracer into a deadlock. > - With the alternative patch below that non-privileged can no longer send the > tracer into a deadlock, but it can still quickly escape out of the tracer's > control. > - But with my latest patch a sufficiently privileged tracer can neither be > sent into a deadlock nor can the attached process escape. Mission completed. Thanks for the details. And it would be pretty unfriendly to fail the execve() too (or, rather, it makes the execve failure unpredictable). I'll keep reading your patch... -- Kees Cook