From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 195FEC433FE for ; Fri, 24 Sep 2021 00:05:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6E8B611B0 for ; Fri, 24 Sep 2021 00:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236458AbhIXAHZ (ORCPT ); Thu, 23 Sep 2021 20:07:25 -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-arch@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