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.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B9FA8C10F27 for ; Tue, 10 Mar 2020 20:55:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7037924649 for ; Tue, 10 Mar 2020 20:55:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HoWjp37P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7037924649 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0AA216B0003; Tue, 10 Mar 2020 16:55:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05B566B0006; Tue, 10 Mar 2020 16:55:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8AA26B0007; Tue, 10 Mar 2020 16:55:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id D23036B0003 for ; Tue, 10 Mar 2020 16:55:57 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 97261180AD81D for ; Tue, 10 Mar 2020 20:55:57 +0000 (UTC) X-FDA: 76580659554.02.dirt57_6e343d49c484e X-HE-Tag: dirt57_6e343d49c484e X-Filterd-Recvd-Size: 5818 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 20:55:57 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id n7so42992pfn.0 for ; Tue, 10 Mar 2020 13:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XCee8pfoSpfKAyMHOiluaFP5r2d1cxa5sV/2QbU588A=; b=HoWjp37PtFeniqj35yD1VTg9ADYkej22MfwMB13TIeFC7foF85mFkueDcopx5DNEc6 Gnjfy52P9IdsdWJrxkP6VvsqgV7Ue9g2VZYhaEy0A6IxGTIL6JYTjbsqPyWEMiArT+m7 INOy2/C/ssYCuaWafqLRtBe62wmczU69h1pvQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XCee8pfoSpfKAyMHOiluaFP5r2d1cxa5sV/2QbU588A=; b=X9A+sA9Nk4AdsFi2UuZfxkSOZpUvTQgdaBWPHpe/7AO3VdG3TzbXtjSbw1cIoh9ffJ 2gMOlPR0HaLcmZYBHuT6CFwcqyNXR0Ay5r6LMtv7XZ7KGrTSlHIuLWyJnPZDaObX8J+u La7uZXJMcfHppvgdmlbUlC1fBhUC8DbH+LMFGiO4VdiS5kG/kpi6mI3zL7ANMF5GC8q9 RRjccxMcumdyC0bUkAtdaX/xjDxAMLWM6XGrnCS0U9GOZB/YFM4piwbHi+swSFc1KsmN AYIOgHVuWw8BfwP7hp9h8uNHqxHs/EivloKUAiaQtr6YS7WghmBZJUrNi+e4TgBHqhYs ihBQ== X-Gm-Message-State: ANhLgQ1Vni8SBsvJO0P9tmf9acXuq8+LcenwQKqtjDfG1XiLEEgePc5x a5dcsHtHkqvvvaFo6CifyabNtA== X-Google-Smtp-Source: ADFU+vv4dCRRSTIODLKjbWRTG/zSV8gZAQ/i5OlKX+nEWRlVelr9/0GQ269GPVKo38XW0ci648ABSw== X-Received: by 2002:a63:450b:: with SMTP id s11mr22416425pga.45.1583873756120; Tue, 10 Mar 2020 13:55:56 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w138sm5130844pff.145.2020.03.10.13.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 13:55:55 -0700 (PDT) Date: Tue, 10 Mar 2020 13:55:54 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: Bernd Edlinger , Christian Brauner , Jann Horn , 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 , 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" , "linux-api@vger.kernel.org" Subject: Re: [PATCH v2 5/5] exec: Add a exec_update_mutex to replace cred_guard_mutex Message-ID: <202003101352.28BE3BEB4@keescook> References: <87v9ne5y4y.fsf_-_@x220.int.ebiederm.org> <87zhcq4jdj.fsf_-_@x220.int.ebiederm.org> <878sk94eay.fsf@x220.int.ebiederm.org> <87r1y12yc7.fsf@x220.int.ebiederm.org> <87k13t2xpd.fsf@x220.int.ebiederm.org> <87d09l2x5n.fsf@x220.int.ebiederm.org> <871rq12vxu.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871rq12vxu.fsf@x220.int.ebiederm.org> 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: On Mon, Mar 09, 2020 at 02:02:37PM -0500, Eric W. Biederman wrote: > exec: Add exec_update_mutex to replace cred_guard_mutex > > The cred_guard_mutex is problematic as it is held over possibly > indefinite waits for userspace. The possilbe indefinite waits for > userspace that I have identified are: The cred_guard_mutex is held in > PTRACE_EVENT_EXIT waiting for the tracer. The cred_guard_mutex is > held over "put_user(0, tsk->clear_child_tid)" in exit_mm(). The > cred_guard_mutex is held over "get_user(futex_offset, ...") in > exit_robust_list. The cred_guard_mutex held over copy_strings. I suspect you're not trying to make a comprehensive list here, but do you want to mention seccomp too (since it's yet another weird case). > [...] > Holding a mutex over any of those possibly indefinite waits for > userspace does not appear necessary. Add exec_update_mutex that will > just cover updating the process during exec where the permissions and > the objects pointed to by the task struct may be out of sync. Should the specific resources be pointed out here? creds, mm, ... ? But otherwise, yup, looks sane: Reviewed-by: Kees Cook -- Kees Cook