Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752393AbdIAT3Z (ORCPT ); Fri, 1 Sep 2017 15:29:25 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:54823 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281AbdIAT3W (ORCPT ); Fri, 1 Sep 2017 15:29:22 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Prakash Sangappa Cc: David Miller , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, drepper@redhat.com References: <1503965540-30393-1-git-send-email-prakash.sangappa@oracle.com> <20170829.160232.1901318933754673000.davem@davemloft.net> <87ziahzzhx.fsf@xmission.com> <87inh5ymv2.fsf@xmission.com> Date: Fri, 01 Sep 2017 14:29:09 -0500 In-Reply-To: (Prakash Sangappa's message of "Fri, 1 Sep 2017 10:30:31 -0700") Message-ID: <878thyw73u.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=1dnrcw-0003yX-Ap;;;mid=<878thyw73u.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.200.44;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19FsWDGYGQbueqWl4coTlepa5d3tOTf154= X-SA-Exim-Connect-IP: 67.3.200.44 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.5 BAYES_05 BODY: Bayes spam probability is 1 to 5% * [score: 0.0175] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Prakash Sangappa X-Spam-Relay-Country: X-Spam-Timing: total 5683 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 2.6 (0.0%), b_tie_ro: 1.77 (0.0%), parse: 0.91 (0.0%), extract_message_metadata: 14 (0.2%), get_uri_detail_list: 1.46 (0.0%), tests_pri_-1000: 7 (0.1%), tests_pri_-950: 1.14 (0.0%), tests_pri_-900: 0.89 (0.0%), tests_pri_-400: 20 (0.4%), check_bayes: 19 (0.3%), b_tokenize: 6 (0.1%), b_tok_get_all: 7 (0.1%), b_comp_prob: 1.88 (0.0%), b_tok_touch_all: 2.3 (0.0%), b_finish: 0.55 (0.0%), tests_pri_0: 233 (4.1%), check_dkim_signature: 0.51 (0.0%), check_dkim_adsp: 2.8 (0.1%), tests_pri_500: 5401 (95.0%), poll_dns_idle: 5393 (94.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RESEND PATCH] Allow passing tid or pid in SCM_CREDENTIALS without CAP_SYS_ADMIN 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1710 Lines: 43 Prakash Sangappa writes: > On 8/30/17 10:41 AM, ebiederm@xmission.com wrote: >> Prakash Sangappa writes: >> >> >>> With regards to security, the question basically is what is the consequence >>> of passing the wrong id. As I understand it, Interpreting the id to be pid >>> or tid, the effective uid and gid will be the same. It would be a problem >>> only if the incorrect interpretation of the id would refer a different process. >>> But that cannot happen as the the global tid(gettid() of a thread is >>> unique. >> There is also the issue that the receiving process could look, not see >> the pid in proc and assume the sending process is dead. That I suspect >> is the larger danger. >> > > Will this not be a bug in the application, if it is sending the wrong > id? No. It could be deliberate and malicious. >>> As long as the thread is alive, that id cannot reference another process / thread. >>> Unless the thread were to exit and the id gets recycled and got used for another >>> thread or process. This would be no different from a process exiting and its >>> pid getting recycled which is the case now. >> Largely I agree. >> >> If all you want are pid translations I suspect the are far easier ways >> thant updating the SCM_CREDENTIALS code. > > What would be an another easier & efficient way of doing pid translation? > > Should a new API/mechanism be considered mainly for pid translation purpose > for use with pid namespaces, say based on 'pipe' something similar to > I_SENDFD? There are proc files that provide all of the pids of a process you can read those. Other possibilities exist if you want to go that fast. Eric