Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5448445imu; Sat, 1 Dec 2018 17:30:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/WOoqL8JlLxZc8CV1UJ+VAmusJjeMkZPjoQfLmXcVoTAz0TWpeUpN6Jjm6Ei9KLl8hrpEVi X-Received: by 2002:a62:f54f:: with SMTP id n76mr10957880pfh.59.1543714246048; Sat, 01 Dec 2018 17:30:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543714246; cv=none; d=google.com; s=arc-20160816; b=PHIedA9vraym/FTGTNfvJJPFSqM7GvDqv96sQ8dQ8IOHyYhNRX0iCW5WU/qmY0XSrs cSyfpqaNbt+jO+GWcd5StJSP589kWJK5YZwlyiJzcPAlyjyIJEofyolK7IS6PU54qcum mkbRQ0uxLm4F+y7W/xtexOwJlcsPOPjweqA6OcDD+NAPzNrfv3BgnaLPeKSr0RhmAzI5 vtgoeyMekl5vRhNyHJdKARQ12hNy6aFYaQ5+MOJgVj+wPk7VUHcF5DK1a5UWHFAMo3bT yeifei99ONZCS5c0eLC65mkDIpGv+xKRBlpFJGlw2lfzuRqPqZ0v4qAg3/g7w/nMCJYt NPPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vqjE8kY/W8TBvmFIV/zcYS6ctyEjfe1Vj6qREgb01zI=; b=AokodvvfpWaQYsLHxvy4tfqrqZbVT63J95cJC7IEpewLG8745bfZ5730w2vS9anztc vTHkEdpq2ccA4UVAxZbnZ1rchJhmvOd5GQ1JkxHEADOp3+T+3ZMhBQHVUCKfzvwvCnY/ h844mRLPcEf09WX0g1c7rku9EsdPg21QLmwitwz/3I1EoQ3cdGozVFeXtUg/QYnAetX0 L4B53fix/7tZSnl63kgHIvBbWAXyc3hqoVgo17e62NIH69VnqUXDfbjS6KzlqRQY1g8S cQ4fDa/BevgSSxN8Qm3UcVbXqDCOk41KW1f3PONFxwLjbDC5yhSPmdnkmfgMzxF9+KJH pgLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fxcsAr2a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q73si10061766pfi.205.2018.12.01.17.29.56; Sat, 01 Dec 2018 17:30:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fxcsAr2a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725765AbeLBMhH (ORCPT + 99 others); Sun, 2 Dec 2018 07:37:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:42342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725755AbeLBMhG (ORCPT ); Sun, 2 Dec 2018 07:37:06 -0500 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C5EA7214DB for ; Sun, 2 Dec 2018 01:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543713300; bh=55yCeGF5W0TbXQvCbbEA6l7ce3nwXs4UZL+AxWROptw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=fxcsAr2a+CkqXIzsc9KZ4iFS1ZQ1HvMqYcjFMAbz87CHf/3iPInVxl+r9RDDIWW5g YGvgLOiA3H/WSlP3GbtX9Xd5kgHz0/ty7bdNLrcLa77MHGmzmIsP4Nu8an4MzxtlFE 968z024azx82wWDRcgBwAcx28kD7q6fl+mDQ9sB0= Received: by mail-wm1-f54.google.com with SMTP id y185so4338566wmd.1 for ; Sat, 01 Dec 2018 17:14:59 -0800 (PST) X-Gm-Message-State: AA+aEWa6KEHRuepKBKanLP4H5JA7mcNkgiRymSk3GK6/HYmPT2XKYfWZ n3K3AcyfbUepwg9VlSQkRzjNlnG3pCS3Hjer/QbFVQ== X-Received: by 2002:a1c:f112:: with SMTP id p18mr3313555wmh.83.1543713298007; Sat, 01 Dec 2018 17:14:58 -0800 (PST) MIME-Version: 1.0 References: <20181120105124.14733-1-christian@brauner.io> <87in0g5aqo.fsf@oldenburg.str.redhat.com> <36323361-90BD-41AF-AB5B-EE0D7BA02C21@amacapital.net> <993B98AC-51DF-4131-AF7F-7DA2A7F485F1@brauner.io> <20181129195551.woe2bl3z3yaysqb6@brauner.io> <6E21165F-2C76-4877-ABD9-0C86D55FD6AA@amacapital.net> <87y39b2lm2.fsf@xmission.com> <20181130065606.kmilbbq46oeycjp5@brauner.io> <87y399s3sc.fsf@xmission.com> <87tvjxp8pc.fsf@xmission.com> <87lg58pzae.fsf@xmission.com> In-Reply-To: <87lg58pzae.fsf@xmission.com> From: Andy Lutomirski Date: Sat, 1 Dec 2018 17:14:45 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] signal: add procfd_signal() syscall To: "Eric W. Biederman" Cc: Arnd Bergmann , Christian Brauner , Andrew Lutomirski , Florian Weimer , LKML , "Serge E. Hallyn" , Jann Horn , Andrew Morton , Oleg Nesterov , Aleksa Sarai , Al Viro , Linux FS Devel , Linux API , Daniel Colascione , Tim Murray , linux-man , Kees Cook Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 1, 2018 at 4:07 PM Eric W. Biederman wr= ote: > > Andy Lutomirski writes: > > >> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman = wrote: > >> > >> > >> It just occurs to me that the simple way to implement > >> procfd_sigqueueinfo info is like: > >> > >> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t *uinf= o) > >> { > >> #ifdef CONFIG_COMPAT > >> if (in_compat_syscall) > >> return copy_siginfo_from_user32(info, uinfo); > >> #endif > >> return copy_siginfo_from_user(info, uinfo); > >> } > >> > >> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo) > >> { > >> kernel_siginfo info; > >> > >> if (copy_siginfo_from_user_any(&info, uinfo)) > >> return -EFAULT; > >> ...; > >> } > >> > >> It looks like there is already a place in ptrace.c that already > >> hand rolls copy_siginfo_from_user_any. > >> > >> So while I would love to figure out the subset of siginfo_t tha we can > >> just pass through, as I think that would make a better more forward > >> compatible copy_siginfo_from_user32. > > > > Seems reasonable to me. It=E2=80=99s less code overall than any other s= uggestion, too. > > > >> I think for this use case we just > >> add the in_compat_syscall test and then we just need to ensure this ne= w > >> system call is placed in the proper places in the syscall table. > >> > >> Because we will need 3 call sights: x86_64, x32 and ia32. As the layo= ut > >> changes between those three subarchitecuters. > >> > >> > > > > If it=E2=80=99s done this way, it can just be =E2=80=9Ccommon=E2=80=9D = in the 64-bit > > table. And we kick the can a bit farther down the road :) > > > > I=E2=80=99m working on patches to clean up x86=E2=80=99s syscall mess. = It=E2=80=99s slow > > because I keep finding new messes. So far I have rt_sigreturn working > > like every other syscall =E2=80=94 whee. > > > > Also, Eric, for your edification, I have a draft patch set to > > radically simplify x86=E2=80=99s signal delivery and return. Once that= =E2=80=99s > > done, I can trivially speed up delivery by a ton by using sysret. > > Nice. > > Do we care about the performance of synchronous signal delivery (AKA > hardware exceptions) vs ordinary signal delivery. I get the feeling > there are serious simplifications to be had in that case. > I dunno what user code cares about. Linux's support for synchronous exception handling is so far behind, say, Windows, that I don't know if it's even used for anything very serious. We should probably profile it after I finish my changes and we can see how bad it is. We can't do anything at all about the time it takes the CPU to deliver the exception, and trying to avoid IRET when we return would be tricky at best, although siglongjmp() might end up skipping it.