Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1056704pxb; Thu, 23 Sep 2021 17:10:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOF94zOxxZzDEJYIxetmS6/DXyonOTd4M7jBF7D9zL2krGDHMG40yKtHRwGTZGHNy4W0AT X-Received: by 2002:a17:906:1e0c:: with SMTP id g12mr8458927ejj.155.1632442253368; Thu, 23 Sep 2021 17:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632442253; cv=none; d=google.com; s=arc-20160816; b=CZxfc6m4DK/eHI9hiCItAlyAxAuwOQ4zrGYNB8624dQJ1fWn7Pabg9xkHxBVeI9bD9 OEI9SzyHftu6u0GKWzIwAqsrcQoG04uzbo2UEBtVgl780ctt1Y5rXQ4cFA0QCrPmRFpQ oYyYJr5medCxmXu89gtxAMWLD6L151Q0Bg1H1Z97jWVFvIEwnO4yVlejkmluU2Oo5vUf XfHSJUMoftEKZ0tFdWNeqC/RPYWFPF9nsfBULSvwYM0XBm5gcduHI9R1quM4mjq2XzI9 /bXUKMm21nIy2ZMh90S8mmPgZjm2WoRBzM9uz/vxhS4ugSt7wlq/UfWjNJqtTBSuaD66 392g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=oY8EuJiYEKvkUjpvE7Y5S4ag1Dg/um8EAc+9e8mXoRw=; b=wLsJddVhgoMGbvLnvAxg6QiqnIEth1vUQBrFRDoGCdgV73l8FdLzik0Lhy6HTSM+VV yEdxVNfIx5ZCnoMDo4Cnr7DQrHZ6uX4t6Nz0j5WpB9B2nNw0Wz18HbKsQSqf0k3OICZ4 4ZMvP58gljS25XXXTivedZa80KMYFQu6Sp00NJensRDqkX0/RMwJs18RosnhNGtm7UzB d9TxD4FISg+Ck25XTo57RBEH1Xg9dcG398n3UwwdbL32n2/q43Nh5JuG2rMwyGZKNJX2 sm79HIOGlFLeVYENtZvxZkSv7T8we0n+sxx15dxuab6b9cC0n5cV74EABVPFBeWIeJ76 pnkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xA8c8+gH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id og48si7212331ejc.686.2021.09.23.17.10.27; Thu, 23 Sep 2021 17:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xA8c8+gH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243620AbhIXAH0 (ORCPT + 99 others); Thu, 23 Sep 2021 20:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232143AbhIXAHZ (ORCPT ); Thu, 23 Sep 2021 20:07:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43736C061574; Thu, 23 Sep 2021 17:05:53 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632441951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oY8EuJiYEKvkUjpvE7Y5S4ag1Dg/um8EAc+9e8mXoRw=; b=xA8c8+gHSrJKHkvWZ2jPU2Ndt91Zzd/URXlXCRD1wTNrq15B+kSlp/1PY15x+diOt9PkKa 8INdgMX1p0OPg9fU5X/uXNW/ymZfXrCkWJ1eqoWTfsJHn9Bt4/qUpBNCHSEPHEewfc1pkd w3OwUUH/TZHUz+JHeHqFVW5STwVDVNnYUSvFLC/TnYkwUa3skd0R4Bt/6NlFWfYoHN63h3 oV0sNk9YJOTc1rSHhyQAq/oQJX7XjCpGd1Y/veBDuDI7TZvhZCW2/n6zF3HMeYUM+gcOkF s0eUtwJ2T/BeY2KtS7n2eEZXWW35leUit4hlpCK9w87Fw3DB80dUmX3LvtYHUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632441951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oY8EuJiYEKvkUjpvE7Y5S4ag1Dg/um8EAc+9e8mXoRw=; b=07PjkRSxh+DGScz1Vj7xjE/dEP53ru2E9F94RJcbaZBEI//uuNfyU2zFv+/LfcIOldKwZN vnMpzG8GyE8K2pAA== To: Greg KH , Sohil Mehta Cc: x86@kernel.org, Tony Luck , Dave Hansen , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Jens Axboe , Christian Brauner , Peter Zijlstra , Shuah Khan , Arnd Bergmann , Jonathan Corbet , Ashok Raj , Jacob Pan , Gayatri Kammela , Zeng Guang , Dan Williams , Randy E Witt , Ravi V Shankar , Ramesh Thomas , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 06/13] x86/uintr: Introduce uintr receiver syscalls In-Reply-To: References: <20210913200132.3396598-1-sohil.mehta@intel.com> <20210913200132.3396598-7-sohil.mehta@intel.com> Date: Fri, 24 Sep 2021 02:05:51 +0200 Message-ID: <87a6k2g7mo.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 23 2021 at 14:26, Greg KH wrote: > On Mon, Sep 13, 2021 at 01:01:25PM -0700, Sohil Mehta wrote: >> +SYSCALL_DEFINE2(uintr_register_handler, u64 __user *, handler, unsigned int, flags) >> +{ >> + int ret; >> + >> + if (!uintr_arch_enabled()) >> + return -EOPNOTSUPP; >> + >> + if (flags) >> + return -EINVAL; >> + >> + /* TODO: Validate the handler address */ >> + if (!handler) >> + return -EFAULT; > > Um, that's a pretty big "TODO" here. > > How are you going to define what is, and what is not, an allowed > "handler"? The requirement is obviously that this is a valid user space address, but that's so hard to validate that it needs to be done later. At least the documentation claims that a non user space address should result in a #GP on delivery. Whether that holds in all corner cases (see the spurious handling muck) is a different question and might come back to us later through a channel which we hate with a passion :) > I'm sure the security people would like to get involved here, as well as > the auditing people. Have you talked with them about their requirements > for this type of stuff? The handler is strictly a user space address and user space is generally allowed to shoot itself into the foot. If the address is bogus then this will resolve into inaccessible, not-mapped or not exectuable space and the application can keep the pieces. Whether the hardware handles the resulting exception correctly is a different question, but that can't be prevented by any sanity check on the address at registration time. Thanks, tglx