Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3151059ybb; Mon, 13 Apr 2020 01:37:37 -0700 (PDT) X-Google-Smtp-Source: APiQypL9LJTQYZ9fEz4ywUGoCDOGkfHcxUhhLjCqSNoMVYrjQbiH3JCCWPOpXw9sI+hmsSaBpNsT X-Received: by 2002:a17:906:7282:: with SMTP id b2mr5135384ejl.161.1586767057705; Mon, 13 Apr 2020 01:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586767057; cv=none; d=google.com; s=arc-20160816; b=YrXaaU9swzNHUdKDyHvO/fdWAJ1tWjm4iZU1In98b7RgWvRxD7DDI9rblnmLFLu4ko bCBXLaNNQ9X54Zj9NWk7t1qtOEch+KxII5o1RfLp06VJmnLH44r/S/q/2iSUtgGVdzvT szbnQj3ScvQopryrX0/w9EP9+BUpCSWbEnfGKxTyJaZGFXJqBEBUTG9Ou2Rwacc4ckd8 Xdi2X6Ij+xb5PNG0basIU3QN0MReOlImRVzuqHXfBSZMieQzn4qXMxZ1t1HzN7x+JnBc QEA9i6QDoqEhOFuTAGPegz5L8YLkiTLR2YbS5DZGAEFq2lK1EDn4QdpEdsYnKn9U5eyP Zn7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dkKaQ8e58hW+EwI1ZMWf6joU++0Hx4+kuiK9v/2dsLY=; b=AyO2Hbb7f/rzBqcorEzeeD66JwvGjmQznwxAOQSwVpxgqd/NZqR26zzY4uMuvH1vQx 0gt/0jkf3qTjlI+QhLENN1KK9XmWF9wzcEhL86EeM8pUfO7g5L67WnMP5gyCkwATSE5h PUPLdBR0SUFAMlDMgROQrb4qYhMwgkuSwqzCiQZrkw1tXXqXQnMMgS9abojp2qXV3E6U /58CVNmPMfpi0Yab1rD7s5wCSVxZzpEVbiiwv3Iowl5OyiU8p5JVP1/vtO6w76AyjSUL yxZENDlqKR5vOA/4Wcb1lbXCMK5JJq5xtcLV7zg3JBBWzFG1EEiHJK/fGrS0uO2eWKYa /0Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="I/RqJDXe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si3887386ejk.0.2020.04.13.01.36.48; Mon, 13 Apr 2020 01:37:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="I/RqJDXe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbgDLTvC (ORCPT + 99 others); Sun, 12 Apr 2020 15:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:57130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727315AbgDLTvC (ORCPT ); Sun, 12 Apr 2020 15:51:02 -0400 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2C1C0A3BF0 for ; Sun, 12 Apr 2020 12:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586721060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dkKaQ8e58hW+EwI1ZMWf6joU++0Hx4+kuiK9v/2dsLY=; b=I/RqJDXePjTxchC2G7moBEgmEzMkjJv6p6IzsNS2HKL7VOkmHtMFI+AaZADJCHi+fwfhuu pL2PuY1gcJC5GUu48vPddpLRqcL5WGHYVG2CIuD6P01pkVQmhZs9Hn3G9GUopifQV5TGML W43lxDirnAtNmB+FVWpCgQoMXlTB3PA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-hK6QV5XPMLWEuuKcKDgVYA-1; Sun, 12 Apr 2020 15:50:56 -0400 X-MC-Unique: hK6QV5XPMLWEuuKcKDgVYA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 663F4800D53; Sun, 12 Apr 2020 19:50:55 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.67]) by smtp.corp.redhat.com (Postfix) with SMTP id 32C9060BE0; Sun, 12 Apr 2020 19:50:49 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 12 Apr 2020 21:50:55 +0200 (CEST) Date: Sun, 12 Apr 2020 21:50:49 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: "Eric W. Biederman" , Bernd Edlinger , Waiman Long , Ingo Molnar , Will Deacon , Linux Kernel Mailing List , Alexey Gladkov Subject: Re: [GIT PULL] Please pull proc and exec work for 5.7-rc1 Message-ID: <20200412195049.GA23824@redhat.com> References: <87imi8nzlw.fsf@x220.int.ebiederm.org> <20200411182043.GA3136@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11, Linus Torvalds wrote: > > On Sat, Apr 11, 2020 at 11:21 AM Oleg Nesterov wrote: > > > > On 04/09, Linus Torvalds wrote: > > > > > > (1) have execve() not wait for dead threads while holding the cred > > > mutex > > > > This is what I tried to do 3 years ago, see > > Well, you did it differently - by moving the "wait for dead threads" > logic to after releasing the lock. Yes, please see below. > My simpler patch was lazier To be honest, I don't understand it... OK, suppose that the main thread M execs and zap_other_threads() finds a single (and alive) sub-thread T, sig->notify_count = 1. If T is traced, then ->notify_count won't be decremented until the tracer reaps this task, so we have the same problem. This is fixeable, say, we can uglify exit_notify() like my patch does, but: > - just don't wait for dead threads at all, > since they are dead and not interesting. Well, I am not sure. Just for example, seccomp(SECCOMP_FILTER_FLAG_TSYNC) can fail after mt-exec because seccomp_can_sync_threads() finds a zombe thread. Sure, this too can can be fixed, but I think there should be no other threads after exec. And: > You do say in that old patch that we can't just share the signal > state, but I wonder how true that is. We can share sighand_struct with TASK_ZOMBIE's. The problem is that we can not unshare ->sighand until they go away, execing thread and zombies must use the same sighand->siglock to serialize the access to ->thread_head/etc. OK, we probably can if we complicate unshare_sighand(), we will need to take tasklist_lock/oldsighand->siglock unconditionally to check oldsighand->count > sig->nr_thread, then do for_each_thread(current, t) { t->sighand = newsighand; __cleanup_sighand(oldsighand); } but see above, I don't think this makes any sense. Oleg