Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7293484imm; Tue, 24 Jul 2018 11:32:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe9KZGoeKQT7LnG4WTXKEkJOrI0DiEul5Wj4K20MCZMQ3IpyNtFHsH26IOkWSJ61Vbg8nH7 X-Received: by 2002:a63:1f4d:: with SMTP id q13-v6mr17506964pgm.241.1532457126261; Tue, 24 Jul 2018 11:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532457126; cv=none; d=google.com; s=arc-20160816; b=tThnMfO/a9bfH6V1YWAZNLiEQ0xnuW00TOcvei0XBopmfqV9R0bLvIPu+sLUieRENV LQJOMZsd6JSHtMrPRMVPFmV9of2iNlLjK9VXPHfT+9JFE3AwDHnNKjpbUX3mWMlCEwaP w2fvXa/g9iqa60tIdKyc7J+qfeY3I2+o+MqhsvprRaXNfregUc8aCZud51cq+OYAm1yQ rkvRke2/ZnjF/WuiH5pfW388QvZx2s02zQEQPHey1kfs8ISoUy6mecBD6V7Ns2VUL3cL ypSqrIBYgToy3bFm+BajfyxKrvxruAlWCVVn1DlOjcBwiG9kV+1fjvcYDtdyWtjb45rk s4qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=i/EkRxm9AT/g25xMRscHdEIcaT5x87CGATQpi9kuXh8=; b=SqLwCONrj00Uim8S7tmvs7rE4/LNYdfoIZXI0KqYXWe+Ggp+3o8mh7xlJNif6KBhXJ ohFRfhTyr3ObjaWqtxviDBocZIzV0iU0EiI4QF5r7ZK0ybgxiPH5dvhFfmA1fOoYigmx 1y5HKBpWf4hv14iSJW1svLjuSC+D8UC3FJcnBmO3aDgJqklcUPKZwKRbEu37QbH6fklW jHCQKSjQLbDilRhOn0go8duIqe4YQbG8JajacJ1b2B+DpJ72EFTCBlKj8O85C9SNyV3o RybpP+sbHIep/DUkryifypU4e2en3AX+IgJszI4u1zWLplntl+Lu5py5esJLKDvvoObX sEvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RKBm8jQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si11144196pga.113.2018.07.24.11.31.51; Tue, 24 Jul 2018 11:32:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RKBm8jQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388647AbeGXThg (ORCPT + 99 others); Tue, 24 Jul 2018 15:37:36 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:39682 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388455AbeGXThf (ORCPT ); Tue, 24 Jul 2018 15:37:35 -0400 Received: by mail-it0-f67.google.com with SMTP id g141-v6so5098246ita.4 for ; Tue, 24 Jul 2018 11:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i/EkRxm9AT/g25xMRscHdEIcaT5x87CGATQpi9kuXh8=; b=RKBm8jQO8Tc671imyBWUDy6XvTpCunK/3UThRSu/Ig73CMuAfq53/ieHVJ+Lwji3qg 4Z9R/ZjOHGQ6EDuZ/o3t4PQeDj1bpt3QP9+lfUMZAQEwB1MklCnna8eSVg5+oqgnDlgX l1072V708hEcI6CYbXJS4yfM4fCo7SQ/sDm/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i/EkRxm9AT/g25xMRscHdEIcaT5x87CGATQpi9kuXh8=; b=Kt2uyCUDpWxhqnDA3Cb0o34T6ob1hOEDVkp9XZ7ERHm2pVX2hZdqLqX5uBtlpJvIhE vK87rQvVHMP2HZSbiQ97VwpeMwS95sV1w4msXFQVrItbhD0OTD75JS9m0R/7OyaMoFmO Mv9exTS1T3kuSUEBE8DYyGcnkkdntPXu8VcHdVK3s4Vm9G8fEky0GPoA7BUj112Y5Fgn SYpjlXnFKWpgKMiL68bEYWOGDD3tX/+eK04ZzRIE6iBysaI/i28Qfa0bINpt/VsEfO6W 97Km94JL6j8olRHdmGj7iK3g4rUOAVVaV7O7dLqYKUTPIo3ZgrYZZPx0KI94mb2LqoFO x/MA== X-Gm-Message-State: AOUpUlFdGEapBSSt4dn7blXnn/3kWRyKfRRRfl3bmTg33Qc4VBbnJzqG Boh14KvsvULX+Vvx7jECR8dQEGo3oFJATVQHU1c= X-Received: by 2002:a24:5002:: with SMTP id m2-v6mr3640515itb.16.1532456990629; Tue, 24 Jul 2018 11:29:50 -0700 (PDT) MIME-Version: 1.0 References: <87efft5ncd.fsf_-_@xmission.com> <20180724032419.20231-20-ebiederm@xmission.com> <874lgo5xdg.fsf@xmission.com> In-Reply-To: <874lgo5xdg.fsf@xmission.com> From: Linus Torvalds Date: Tue, 24 Jul 2018 11:29:39 -0700 Message-ID: Subject: Re: [PATCH 20/20] signal: Don't restart fork when signals come in. To: "Eric W. Biederman" Cc: Oleg Nesterov , Andrew Morton , Linux Kernel Mailing List , Wen Yang , majiang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 24, 2018 at 10:58 AM Eric W. Biederman wrote: > > Yes you are quite right. Easy enough to fix, but it definitely needs > to be fixed. > > I will respin. Would you mind trying a slightly different approach for this? How about moving the "copy_signal()" and "copy_sighandler()" cases up to fairly early in the "copy_process()" function (and clean up late, obviously). Then, instead of that "struct multiprocess_signals" thing, just add a "struct hlist_node node" to "struct signal" itself, and add it to the multiprocess hlist there. And then you can just remove it in bad_fork_cleanup_signal. Does this make "struct signal" a bit larger? Yes, but it's not a huge deal. We *could* make is some union with existing fields if we cared. But I think it would make the code *much* more understandable, and it would allow us to not have that "sigpending" copy, because you can just populate the final "signal->shared_pending" directly. Hmm? Linus