Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp9195imm; Tue, 10 Jul 2018 19:42:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfi6jmJ4yxodhtfkYn79gpt16roYCA8ys9fsnU1AAi4giixkf0qRlzS7oS/BQp5btpF37j8 X-Received: by 2002:a62:8a4f:: with SMTP id y76-v6mr22857793pfd.233.1531276935474; Tue, 10 Jul 2018 19:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531276935; cv=none; d=google.com; s=arc-20160816; b=lIhbqnl08lDQ2GJQkZvqYgK5gMoobcet7fCdIF56Y536IAK9lQGZscUcBHhyqyTt32 Ce+7Lv0x+jHMsRiROaK/8Nip6UghY6TxEDMfN3Nqaj0IKcfOj1P5YMuM8wv5tI6FUDF4 t+kxd1KEmTYpqptPEujG4zCKNANQHIpDW2fGNsZnq1reApbIQk1ZEAbpGMDFVtJuenxc KENAIGYQ0t3YmZM8VqwCqS8k+vc4Hb6P6ZjLa8lnsICyu5vTwp0X3qvVwFibCLEXFts2 DQPUbLh2A1paXmAtLWsg4qv6S5lwi4ioDKy/00+hm5nMifTWRT1BulwHJ7RatwgoYnw3 aWGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=QHvNkQafHACWNfZIHBq9v0gQWj25KDx6bQXso7ydsbE=; b=wiYDJ2KIzgf3N7Q3UzxRcGKEx6vdwP5kIBqt7FRz9dIusvIwuuGKI8pkgwgOfjnhuS QWSGMXQkWf1zBObp8R9bAIeLm7OhnJlgGh99jlaMO85pUrHlYD1j6Nm9lGi9R6eJf1Rx BNU4YZQYfir+5yt7yzk/1mu316/yWVFKCzCuflMfDAqaJM/aNEsBfMcfidg4ug1UNWDg rkagw8EyQ7xhS8isEsWFyo+2gCKISpv6UWjG9xECW5ijxetuYjLsf4S9F06ErLTYVuPb 1lStVGJlJxtw+KtO3Uktesd+jmYhGoexz2zPDUdIvl/oVBQe7S05AQrddJJb1a6X/Y5O xYvA== ARC-Authentication-Results: i=1; mx.google.com; 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 v129-v6si19655641pfc.330.2018.07.10.19.41.59; Tue, 10 Jul 2018 19:42:15 -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; 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 S1732372AbeGKCnZ (ORCPT + 99 others); Tue, 10 Jul 2018 22:43:25 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:41283 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732277AbeGKCnZ (ORCPT ); Tue, 10 Jul 2018 22:43:25 -0400 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.87) (envelope-from ) id 1fd54E-0006iy-TI; Tue, 10 Jul 2018 20:41:22 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fd54D-0005jD-3E; Tue, 10 Jul 2018 20:41:22 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Oleg Nesterov , Andrew Morton , , Wen Yang , majiang References: <87h8l9p7bg.fsf@xmission.com> <20180709104158.GA23796@redhat.com> <87sh4so5jv.fsf@xmission.com> <20180709145726.GA26149@redhat.com> <877em4nxo0.fsf@xmission.com> <87lgakm4ol.fsf@xmission.com> <20180710134639.GA2453@redhat.com> Date: Tue, 10 Jul 2018 21:41:16 -0500 In-Reply-To: (Linus Torvalds's message of "Tue, 10 Jul 2018 10:02:42 -0700") Message-ID: <877em2jxyr.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fd54D-0005jD-3E;;;mid=<877em2jxyr.fsf_-_@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18L25p+MLUSS34t6z2IOM0XQWWRMab/I9Y= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa05.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TooManySym_01,XMNoVowels autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 TR_Symld_Words too many words that have symbols inside * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 1285 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.0 (0.2%), b_tie_ro: 2.1 (0.2%), parse: 0.83 (0.1%), extract_message_metadata: 3.1 (0.2%), get_uri_detail_list: 1.47 (0.1%), tests_pri_-1000: 3.6 (0.3%), tests_pri_-950: 1.15 (0.1%), tests_pri_-900: 0.90 (0.1%), tests_pri_-400: 24 (1.9%), check_bayes: 23 (1.8%), b_tokenize: 8 (0.6%), b_tok_get_all: 8 (0.6%), b_comp_prob: 2.4 (0.2%), b_tok_touch_all: 3.3 (0.3%), b_finish: 0.55 (0.0%), tests_pri_0: 1235 (96.1%), check_dkim_signature: 0.65 (0.1%), check_dkim_adsp: 2.9 (0.2%), tests_pri_500: 6 (0.5%), rewrite_mail: 0.00 (0.0%) Subject: [RFC][PATCH 0/11] PIDTYPE_TGID and fewer fork restarts X-Spam-Flag: No 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following patches should be close. I took some patches I haven't taken the time to merge yet that make PIDTYPE_TGID not a hack. Updated the code that deals with signals to handle PIDTYPE_TGID. Pushed the pid type down from the signal senders all of the way down into __send_signal. That work could probably use being split into more than one patch for readability, but it seems reasonble and less of a hack than the "bool group" we have currently. I think I have gotten all of the places we send signals to multiple processes. But I have yet to make an exhaustive examination. I would appreciate some review feedback before I burn a day doing that. All in all this changes a little more than I might hope for but it seems a nicely targted cleanup that sorts out the fork issue. Comments please. I think I am 99% of the way to solving this cleanly but any feedback would be very appreciated. Thank you in advance. Eric W. Biederman (11): pids: Initialize leader_pid in init_task pids: Move task_pid_type into sched/signal.h pids: Compute task_tgid using signal->leader_pid kvm: Don't open code task_pid in kvm_vcpu_ioctl pids: Move the pgrp and session pid pointers from task_struct to signal_struct pid: Implement PIDTYPE_TGID signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PID signal: Use PIDTYPE_TGID to clearly store where file signals will be sent tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasks signal: Push pid type from signal senders down into __send_signal signal: Ignore all but multi-process signals that come in during fork. arch/ia64/kernel/asm-offsets.c | 4 +-- arch/ia64/kernel/fsys.S | 12 +++---- arch/s390/kernel/perf_cpum_sf.c | 2 +- drivers/net/tun.c | 2 +- drivers/platform/x86/thinkpad_acpi.c | 1 + drivers/tty/sysrq.c | 2 +- drivers/tty/tty_io.c | 10 +++--- fs/autofs/autofs_i.h | 1 + fs/exec.c | 1 + fs/fcntl.c | 38 ++++++++-------------- fs/fuse/file.c | 1 + fs/locks.c | 2 +- fs/notify/dnotify/dnotify.c | 3 +- fs/notify/fanotify/fanotify.c | 1 + include/linux/init_task.h | 9 ------ include/linux/pid.h | 11 ++----- include/linux/sched.h | 31 ++++-------------- include/linux/sched/signal.h | 39 +++++++++++++++++++++-- include/linux/signal.h | 6 ++-- include/net/scm.h | 1 + include/trace/events/signal.h | 12 +++---- init/init_task.c | 12 ++++--- kernel/events/core.c | 2 +- kernel/exit.c | 12 ++----- kernel/fork.c | 45 +++++++++++++++++++++----- kernel/pid.c | 42 ++++++++++++------------- kernel/signal.c | 61 ++++++++++++++++++++---------------- kernel/time/itimer.c | 5 +-- kernel/time/posix-cpu-timers.c | 2 +- kernel/time/posix-timers.c | 13 +++----- mm/oom_kill.c | 4 +-- virt/kvm/kvm_main.c | 2 +- 32 files changed, 205 insertions(+), 184 deletions(-)