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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 7343FC3F2D7 for ; Mon, 2 Mar 2020 16:00:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 344CA217F4 for ; Mon, 2 Mar 2020 16:00:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 344CA217F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xmission.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D2A9D6B0003; Mon, 2 Mar 2020 11:00:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CFF3C6B0005; Mon, 2 Mar 2020 11:00:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEF576B0006; Mon, 2 Mar 2020 11:00:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id A8CBE6B0003 for ; Mon, 2 Mar 2020 11:00:01 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3F41945A8 for ; Mon, 2 Mar 2020 16:00:01 +0000 (UTC) X-FDA: 76550883402.05.peace73_747e123e79758 X-HE-Tag: peace73_747e123e79758 X-Filterd-Recvd-Size: 6298 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Mar 2020 16:00:00 +0000 (UTC) Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1j8nTw-0002Lm-9d; Mon, 02 Mar 2020 08:59:48 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1j8nTv-0005zV-Cp; Mon, 02 Mar 2020 08:59:48 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Bernd Edlinger Cc: Jann Horn , Christian Brauner , Jonathan Corbet , Alexander Viro , Andrew Morton , Alexey Dobriyan , Thomas Gleixner , Oleg Nesterov , Frederic Weisbecker , Andrei Vagin , Ingo Molnar , "Peter Zijlstra \(Intel\)" , Yuyang Du , David Hildenbrand , Sebastian Andrzej Siewior , Anshuman Khandual , David Howells , James Morris , Kees Cook , Greg Kroah-Hartman , Shakeel Butt , Jason Gunthorpe , Christian Kellner , Andrea Arcangeli , Aleksa Sarai , "Dmitry V. Levin" , "linux-doc\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , "linux-fsdevel\@vger.kernel.org" , "linux-mm\@kvack.org" , "stable\@vger.kernel.org" References: <20200301185244.zkofjus6xtgkx4s3@wittgenstein> <87a74zmfc9.fsf@x220.int.ebiederm.org> Date: Mon, 02 Mar 2020 09:57:36 -0600 In-Reply-To: (Bernd Edlinger's message of "Mon, 2 Mar 2020 15:43:24 +0000") Message-ID: <87k142lpfz.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1j8nTv-0005zV-Cp;;;mid=<87k142lpfz.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/lt4on91tMaQ1/pOt4zAqlZlKm4+95UyU= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCHv2] exec: Fix a deadlock in ptrace X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Bernd Edlinger writes: > > I tried this with s/EACCESS/EACCES/. > > The test case in this patch is not fixed, but strace does not freeze, > at least with my setup where it did freeze repeatable. Thanks, That is what I was aiming at. So we have one method we can pursue to fix this in practice. > That is > obviously because it bypasses the cred_guard_mutex. But all other > process that access this file still freeze, and cannot be > interrupted except with kill -9. > > However that smells like a denial of service, that this > simple test case which can be executed by guest, creates a /proc/$pid/mem > that freezes any process, even root, when it looks at it. > I mean: "ln -s README /proc/$pid/mem" would be a nice bomb. Yes. Your the test case in your patch a variant of the original problem. I have been staring at this trying to understand the fundamentals of the original deeper problem. The current scope of cred_guard_mutex in exec is because being ptraced causes suid exec to act differently. So we need to know early if we are ptraced. If that case did not exist we could reduce the scope of the cred_guard_mutex in exec to where your patch puts the cred_change_mutex. I am starting to think reworking how we deal with ptrace and exec is the way to solve this problem. Eric