From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbdFGLno (ORCPT ); Wed, 7 Jun 2017 07:43:44 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:56105 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbdFGLnn (ORCPT ); Wed, 7 Jun 2017 07:43:43 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Aleksa Sarai Cc: linux-kernel@vger.kernel.org, Kees Cook , Roland McGrath , linux-api@vger.kernel.org, Linux Containers , Oleg Nesterov , David Howells , Al Viro , Thomas Gleixner , Linus Torvalds , Ingo Molnar , "Michael Kerrisk \(man-pages\)" References: <877f0pym71.fsf@xmission.com> Date: Wed, 07 Jun 2017 06:36:48 -0500 In-Reply-To: (Aleksa Sarai's message of "Wed, 7 Jun 2017 05:40:21 +1000") Message-ID: <87ink8vxkf.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=1dIZN9-0006v8-Vy;;;mid=<87ink8vxkf.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.121.81.159;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18GR9/3Al8frjvVReL6VR9e5ocZ0gl3ULA= X-SA-Exim-Connect-IP: 97.121.81.159 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 TVD_RCVD_IP Message was received from an IP address * 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.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Aleksa Sarai X-Spam-Relay-Country: X-Spam-Timing: total 5335 ms - load_scoreonly_sql: 1.01 (0.0%), signal_user_changed: 6 (0.1%), b_tie_ro: 3.4 (0.1%), parse: 1.94 (0.0%), extract_message_metadata: 29 (0.5%), get_uri_detail_list: 1.95 (0.0%), tests_pri_-1000: 11 (0.2%), tests_pri_-950: 2.5 (0.0%), tests_pri_-900: 2.0 (0.0%), tests_pri_-400: 32 (0.6%), check_bayes: 29 (0.6%), b_tokenize: 11 (0.2%), b_tok_get_all: 7 (0.1%), b_comp_prob: 4.1 (0.1%), b_tok_touch_all: 3.3 (0.1%), b_finish: 0.83 (0.0%), tests_pri_0: 867 (16.2%), check_dkim_signature: 1.09 (0.0%), check_dkim_adsp: 5 (0.1%), tests_pri_500: 4375 (82.0%), poll_dns_idle: 4360 (81.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 00/26] Fixing wait, exit, ptrace, exec, and CLONE_THREAD 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Aleksa Sarai writes: >> Another easy entry point is to see that a multi-threaded setuid won't >> change the credentials on a zombie thread group leader. Which can allow >> sending signals to a process that the credential change should forbid. >> This is in violation of posix and the semantics we attempt to enforce in >> linux. > > I might be completely wrong on this point (and I haven't looked at the patches), > but I was under the impression that multi-threaded set[ug]id was implemented in > userspace (by glibc's nptl(7) library that uses RT signals internally to get > each thread to update their credentials). And given that, I wouldn't be > surprised (as a user) that zombie threads will have stale credentials (glibc > isn't running in those threads anymore). > > Am I mistaken in that belief? Would you be surprised if you learned that if your first thread exits, it will become a zombie and persist for the lifetime of your process? Furthermore all non-thread specific signals will permission check against that first zombie thread. Which I think makes this surprising even if you know that setuid is implemented in userspace. Eric