Received: by 10.223.176.46 with SMTP id f43csp21200wra; Fri, 19 Jan 2018 13:08:48 -0800 (PST) X-Google-Smtp-Source: ACJfBou32NZNAXmMl5kYrhZp/JPAYMQGWV3LrguInCl6sw+UajXfEKetlFBajUwL4Pn6k3vGRbck X-Received: by 10.98.139.8 with SMTP id j8mr31815377pfe.4.1516396128148; Fri, 19 Jan 2018 13:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516396128; cv=none; d=google.com; s=arc-20160816; b=fTW2t4s2eTCz6jjPsCdPhR/PonBBw1cMb/hLP6wefziiDIpJLtEEGoy76K5iVTNWmx JegR3cdJAkFv3iSr23kH1evaWiOPSip5/KDwRYuoNN8zk9DUDsWwL6TEimTfVk1v8pcw DbM/luLP2+7VFr9e4t0LRwfDmIBJ1QrMK6ESQaCi8cAUi8Mj+0RystzZ+1Wj+2jEyv1g HkPE4qSGvt8MGg42UNUQezpEITph+C3uW974m0pOIRWHDoztJIPYI3w6k0ENy4GJ10NO oGP9LvXNS7fYZywGDSv9mQ42RYUc5RFdg331WZqwiAlXyc/gimt8BbITJfKPMQu4vh8W dW5Q== 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=1U6s2PkiA7/LoxbQvUEuWQTe3GA4IvLfUYtTKo+yMZ0=; b=1AwKNggFTfmfPcKv5cGtdtXAt0Ax+q5jQeFgwWLWQR77vnzqhjwIFY40jjfG5yVl8t DGXgZ+9DG8kKOq3dVAndRGIPphxY0TzwtcoNgner7H8Fgmpe5ZaT/5tqMvgzjWyTF7I2 xG3zfOuf6TASdc0HnGC6vso+4mzo5xXMpRaD9I29PbikApjZvYboil5VHP8pvT/vJ1iD 3gd0ltGENH7VklZ3J0DBiNuX0bjyyN+GuTQ4tzMaOFNJbZyPe8+P0oyUw1ooY6GqwAss LrszV5q1+RZKygFqTdXMyrz34aUIaZgeBIBbWIeTm5gO8g7y6rxTcWRShEtYNL+ugx9A Rg5Q== 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 t80si9958336pfa.29.2018.01.19.13.08.33; Fri, 19 Jan 2018 13:08:48 -0800 (PST) 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 S1756473AbeASVFZ (ORCPT + 99 others); Fri, 19 Jan 2018 16:05:25 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:36821 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756525AbeASVFK (ORCPT ); Fri, 19 Jan 2018 16:05:10 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ecdqX-0006xk-Ji; Fri, 19 Jan 2018 14:05:09 -0700 Received: from 97-121-73-102.omah.qwest.net ([97.121.73.102] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ecdqX-0004CH-1I; Fri, 19 Jan 2018 14:05:09 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Al Viro Cc: linux-kernel@vger.kernel.org, Oleg Nesterov , linux-arch@vger.kernel.org References: <87k1wimybi.fsf_-_@xmission.com> <20180116004009.31036-22-ebiederm@xmission.com> <20180119180322.GK13338@ZenIV.linux.org.uk> Date: Fri, 19 Jan 2018 15:04:15 -0600 In-Reply-To: <20180119180322.GK13338@ZenIV.linux.org.uk> (Al Viro's message of "Fri, 19 Jan 2018 18:03:22 +0000") Message-ID: <87shb1a7cg.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=1ecdqX-0004CH-1I;;;mid=<87shb1a7cg.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.121.73.102;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18GvsaK6E2X5vI/Ic5FQ+SZ/qIh2bp3kWw= X-SA-Exim-Connect-IP: 97.121.73.102 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_XMDrugObfuBody_08,XMGappySubj_01,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 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.5 XMGappySubj_01 Very gappy subject * 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 * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 T_XMDrugObfuBody_08 obfuscated drug references X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Al Viro X-Spam-Relay-Country: X-Spam-Timing: total 247 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.6 (1.0%), b_tie_ro: 1.76 (0.7%), parse: 0.77 (0.3%), extract_message_metadata: 11 (4.5%), get_uri_detail_list: 1.93 (0.8%), tests_pri_-1000: 6 (2.2%), tests_pri_-950: 1.16 (0.5%), tests_pri_-900: 1.01 (0.4%), tests_pri_-400: 22 (9.0%), check_bayes: 21 (8.6%), b_tokenize: 7 (2.8%), b_tok_get_all: 7 (3.0%), b_comp_prob: 2.4 (1.0%), b_tok_touch_all: 2.4 (1.0%), b_finish: 0.58 (0.2%), tests_pri_0: 196 (79.2%), check_dkim_signature: 0.48 (0.2%), check_dkim_adsp: 2.6 (1.1%), tests_pri_500: 4.0 (1.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 22/22] signal: Unify and correct copy_siginfo_to_user32 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Al Viro writes: > On Mon, Jan 15, 2018 at 06:40:09PM -0600, Eric W. Biederman wrote: >> Among the existing architecture specific versions of >> copy_siginfo_to_user32 there are several different implementation >> problems. Some architectures fail to handle all of the cases in in >> the siginfo union. Some architectures perform a blind copy of the >> siginfo union when the si_code is negative. A blind copy suggests the >> data is expected to be in 32bit siginfo format, which means that >> receiving such a signal via signalfd won't work, or that the data is >> in 64bit siginfo and the code is copying nonsense to userspace. > > Huh? Negative si_code comes from rt_sigqueueinfo(2); in that case > the sucker is supposed to pass user-supplied opaque chunk of data > in ->_sifields._pad. "Copy everything when ->si_code is negative" > is exactly the right behaviour. Failing to copy it out (and in, for > copy_siginfo_from_user32()) is a bug. > > 32bit tasks should behave on 64bit host like they would on 32bit one > when we have biarch compat. And "application using sigqueueinfo() to > pass data might be using different layouts of the payload" is not > an excuse for failing to transmit it in the first place. If glibc actually offered rt_sigqueueinfo or any function that would queue a full siginfo that would be a compelling argument. As it is the only users of rt_sigqueueinfo that I am aware of is CRIU and the implementation of sigqueue. A couple of months ago I went hunting for users and for anyone who was defining si_codes and I did not find a single instance of anything defining signals that would pass more information than is known to the kernel, and except for CRIU all I found was limited to what you can do with sigqueue. So no I do not think my choice will cause a regression. Further SI_TIMER which the kernel does send is also negative. The difference between negative and positive is that negative si_codes are supposed to be signal agnostic and positive si_codes are signal specific. If this causes a single regression, or if anyone can point me at the code of an application this will cause a regression for. I will change the code right then and there. My concern is that people have not been careful when defining new signals. What looks like rules in one place are not the rules in another place. If we had been careful struct siginfo would be the same on both 32bit and 64bit, and in singalfd. As it is I am battling accidental redefinitions of SI_USER by the kernel to be something else. I think it is far more likley that someone will define a signal layout that needs help going from 64bit to 32bit that my choice not copying all of the bits will catch, rather than I will break some existing userspace application. And if we catch it and the siginfo needs translation because we are not commited to copying everything we can fix it. Which is a long way of saying I think it would be gravely irresponsible to just copy all of the bits of struct siginfo when si_code is negative. Eric