From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbbHES7I (ORCPT ); Wed, 5 Aug 2015 14:59:08 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:60195 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982AbbHES7F (ORCPT ); Wed, 5 Aug 2015 14:59:05 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: "Kirill A. Shutemov" , Andrew Morton , Kees Cook , David Howells , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , "Kirill A. Shutemov" , Rik van Riel , Vladimir Davydov , Ricky Zhou , Julien Tinnes References: <20150728171500.GA2871@www.outflux.net> <20150728143504.5aa996ba5955522a19c2d5f1@linux-foundation.org> <20150728221111.GA23391@node.dhcp.inet.fi> <20150805172356.GA20490@redhat.com> <87wpx9sjhq.fsf@x220.int.ebiederm.org> Date: Wed, 05 Aug 2015 13:52:22 -0500 In-Reply-To: <87wpx9sjhq.fsf@x220.int.ebiederm.org> (Eric W. Biederman's message of "Wed, 05 Aug 2015 13:00:49 -0500") Message-ID: <87614tr2jd.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX186/+82k1jJXLjW5RNz4KHhrz5JqW1WSYs= X-SA-Exim-Connect-IP: 97.119.22.40 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4997] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 258 ms - load_scoreonly_sql: 0.71 (0.3%), signal_user_changed: 7 (2.5%), b_tie_ro: 4.2 (1.6%), parse: 1.94 (0.8%), extract_message_metadata: 3.9 (1.5%), get_uri_detail_list: 0.79 (0.3%), tests_pri_-1000: 7 (2.6%), tests_pri_-950: 1.96 (0.8%), tests_pri_-900: 1.24 (0.5%), tests_pri_-400: 21 (8.3%), check_bayes: 20 (7.8%), b_tokenize: 6 (2.5%), b_tok_get_all: 6 (2.3%), b_comp_prob: 2.4 (0.9%), b_tok_touch_all: 2.8 (1.1%), b_finish: 0.83 (0.3%), tests_pri_0: 191 (74.0%), tests_pri_500: 6 (2.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] user_ns: use correct check for single-threadedness X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hmm. On closer inspection this patch touches on a greater inconsistency then the test to see if the task is the only task using the mm_struct. We currently allow tasks created with clone to have a different user namespace and to share a mm_struct, and I don't think that is wrong. What we actually care about are the uid and gid values that show up in signals that are reported to a process, and for that what we care about is the question do the tasks share signal handling state, which is controlled by the flags CLONE_SIGHAND and CLONE_THREAD. As such current_is_single_threaded() is wrong because it tests to see if there is someone else sharing an mm_struct. So I have to ask. Is it possible to rework these checks such that we look at the sighand struct and signal sharing handling sharing instead of the count on the mm_struct? I suspect we could do that more cheaply, as well as making the code more correct. Eric