Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7941160imu; Thu, 15 Nov 2018 04:08:56 -0800 (PST) X-Google-Smtp-Source: AJdET5d0jz4dsfcUCBmBeW+VlXIgi7d/wlKlPdy5o7HsWU8Vm1se2IDuPDlSo2u5ZtS1FWo40Jd1 X-Received: by 2002:a63:5816:: with SMTP id m22-v6mr5468107pgb.332.1542283736392; Thu, 15 Nov 2018 04:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542283736; cv=none; d=google.com; s=arc-20160816; b=iHcAjeIWaGbHs/3y0MZFA06VOhdxBPBtdLx/t/QeI4P/0crMs6yNUgjllGTAk39And Q2TDSSftVljNYWNHT8tUbD3gJG+pq8L/pwsXum4C+jTQebUayI/xm7aUGPxuTtkyhx4L YJWiKUDCAbsiejuLaTSeoSV3dVAisget7BB0tWY0HM9GtmVB6hMDPnorct66pDtpNGZ9 zGu2FEYZDzVaWHhbkwZjwecFUwSAtnCpUvEzbCSFqNbZT66+B5W/p3JAxcO8jjmEuE/5 YzV/d8D2sbXMYOyQZcrqxyMBXcBhrg1/gG7FJoXtA1+KEEwNd3xh75fW165ObOKDjbwx ynBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SC0iu5+qvyM6BTQbbF+F86byESvB1HjyehgnpM0EmZU=; b=a7B0f2wC5O6YSkz9yEOjLc4quc03fw0JZpx/yjgJAXUYPWjmIvN3qa1WgSigTkF1c0 +wlXUnkxQqCreJjSwNzGbdAWpnfkpYU5pEELleL57RfEPnwxHID0LdYA7iKtsu9EwNQm x+P9a3+BwbDMHyECKBxWi5hAsQ9efT+OE2KDeOCCviFKIgLqk+V0Z/6xPBQ1ZDBfuWr9 JYhZzt8teKkSBkViY+c1M2sKpKGWQUTF+y9fxmj4lDNj3Sbfj8N1lRE/RMZ98Mpyoq3z tOmj1SrWDakaVSHWXBNo3rZuDAwP5e3L2bR7nQXPfv5RAdzg+SXEZsqQvADjy+kQzIOo +8Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=USn7PyKQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e189si7690843pfc.202.2018.11.15.04.08.37; Thu, 15 Nov 2018 04:08:56 -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=@gmail.com header.s=20161025 header.b=USn7PyKQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388189AbeKOWOp (ORCPT + 99 others); Thu, 15 Nov 2018 17:14:45 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:40384 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387706AbeKOWOo (ORCPT ); Thu, 15 Nov 2018 17:14:44 -0500 Received: by mail-it1-f196.google.com with SMTP id e11so28867856itl.5; Thu, 15 Nov 2018 04:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SC0iu5+qvyM6BTQbbF+F86byESvB1HjyehgnpM0EmZU=; b=USn7PyKQ7WKKQ9MU7i1CFvYRkWZjGZdApBCPQ4La7ts7e3P6gRe8POQqu5oxYTSNgv 9R7Km4tCmRrekkS9ghPXmbM0yn6qJh5ToZeJ52J3KElZRqa97ZiogQnuRlpyjQuacGGN MBTF2wW5s7QE8dSw2cMJ36UF3rnl7HnuzJeF9gBTEOLaDcf2YGndRETFngAqc1R7xaO9 4VYdQH8IAVrLB8nqId6vqId9Kklt1ic56caa8liSAjaIpc69AmY1tl949yONA2fNBLJQ LhxVQM6o/VA9yTbTQYI6DDwIFdHWTZQA+D79mQ+DbXhR4aVfgghlUPWejggbifMhoPM8 GJpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SC0iu5+qvyM6BTQbbF+F86byESvB1HjyehgnpM0EmZU=; b=GFR5o2qw79O+kEVXiDpMmGs4oE/qdg0f/FYE8ibFdu5KEqPvJ26nbLn5Q23+nlHaXs bJ/28/N189aD6TwayWWJsLMH0AOa9PwFmaNTak1RLHSvoWqAWw4ygFWdkFQtw8szQ0NI FwPMS2AjNELcyKVKWAwHHwrj0mS/aQIyUKYh2f1P4LaFNUC1BQuF8ZKslWpGOEmX2Pc0 mJFj+P9DhqBuhrKXpANsoOWSFdTxg9+F+Aroj9CuY+ZRnZsafL7Q3p4iSvIdid84WPjb pcU+Rk5HPFetrh3HfiW2RP2sPfLULH+1J00gxEccf3w0DdH6iaSGrbkivDTK8ZFlkCqu Tvlg== X-Gm-Message-State: AGRZ1gLUxsFoQ52E5m1gDn4fki8gLosivuFSDkIH+L0cxdkhGlX864Kt oG+ZoSTjBas8rfu4svVT+VI0FmvQllWxyO2w9c0= X-Received: by 2002:a02:b529:: with SMTP id l38mr5077605jaj.25.1542283625243; Thu, 15 Nov 2018 04:07:05 -0800 (PST) MIME-Version: 1.0 References: <20181114215509.163600-1-ebiggers@kernel.org> <20181114230046.GC87768@gmail.com> In-Reply-To: From: David Herrmann Date: Thu, 15 Nov 2018 13:06:53 +0100 Message-ID: Subject: Re: [PATCH v2] HID: uhid: forbid UHID_CREATE under KERNEL_DS or elevated privileges To: Benjamin Tissoires Cc: Dmitry Torokhov , ebiggers@kernel.org, jannh@google.com, Jiri Kosina , "open list:HID CORE LAYER" , linux-kernel , syzkaller-bugs@googlegroups.com, Dmitry Vyukov , syzbot+72473edc9bf4eb1c6556@syzkaller.appspotmail.com, stable , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey On Thu, Nov 15, 2018 at 9:14 AM Benjamin Tissoires wrote: > > On Thu, Nov 15, 2018 at 12:20 AM Dmitry Torokhov wrote: > > > I think it's best not to make > > > assumptions about how the interface will be used and to be consistent with how > > > other ->write() methods in the kernel handle the misfeature where a __user > > > pointer in the write() or read() payload is dereferenced. > > > > I can see that you might want to check credentials, etc, if interface > > can be accessed by unprivileged process, however is it a big no no for > > uhid/userio/uinput devices. > > Yep, any sane distribution would restrict the permissions of > uhid/userio/uinput to only be accessed by root. If that ever changes, > there is already an issue with the system and it was compromised > either by a terribly dizzy sysadmin. UHID is safe to be used by a non-root user. This does not imply that you should open up access to the world, but you are free to have a dedicated group or user with access to uhid. I agree that in most common desktop-scenarios you should not grant world-access to it, though. > > > > > Temporarily switching > > > to USER_DS would only avoid one of the two problems. > > > > So because of the above there is only one problem. If your system > > opened access to uhid to random processes you have much bigger > > problems than exposing some data from a suid binary. You can spam "rm > > -rf .; rm -rf /" though uhid if there is interactive session > > somewhere. > > > > > > > > Do you think the proposed restrictions would actually break anything? > > > > It would break if someone uses UHID_CREATE with sendpage. I do not > > know if anyone does. If we were certain there are no users we'd simply > > removed UHID_CREATE altogether. > > AFAICT, there are 2 users of uhid: > - bluez for BLE devices (using HID over GATT) > - hid-replay for debugging. There are several more (eg., android bt-broadcom), and UHID_CREATE is actively used. Dropping support for it will break these use-cases. Thanks David