Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp405104pxb; Thu, 30 Sep 2021 08:30:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZulDy4aTO1TEc555OZhvO6xTkOedkJ/GfX3NEC41XrxvYM4xd8dJZTKrEfLZhWMcH5NW6 X-Received: by 2002:a50:cf4d:: with SMTP id d13mr7809530edk.50.1633015844833; Thu, 30 Sep 2021 08:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633015844; cv=none; d=google.com; s=arc-20160816; b=Uua//uC3e8P92Asrc1uzqtgyHTiQfRpXoGL7oujXuE3/SLRgM2siD6cyEFsnZ84QIR DuC0inzZkUXl3f9H7LqPD5WVej+Bo1/CXPlGzw50bgE7E+LJsV/LXLUEbYPk79NgMJ7K T7XGeCmbeaMW5UD+Lth4/Uhhkk9Z+AV8GX38WwghzKfFTwEomhieaFZcMbSktFRwUO0Y cOWwilAOy20B8ZMnOgMqML+QVIabfdqpJPPrPar+MfLT8ydviaGzwk6wcJVEv1WBp4uY g1qihOTvd7tnfSNOWuvmmNNiyBtgE2HldWf40ZXECQfll6hxAA0kDiO7pz/6717B3gIu 26lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Kov2ExqepH9pThCmLoFjisgkKR2/gZ5L5N4itqr434w=; b=MZRbiXQdkm6s31uuAHapu6QitKzf0iM3X8x1c/8wepsP3PXW5oY0uSe+/x82e/EtQn e+jDrZ/VlRwLJ2rMLzTGK5b6Oz18sTGMbYpZA8rtBGKJRtOS1OSGSAWz26PwykaVRrwY iXjglVw3G79Pl8InSoo3SaSAT4LlMViKn5Dr+2ATie5IYgSHLP1DmicNraUDKvxTaLNy PbxPV0H2tisRqXtaebiY0JgU5wZPgzrVb/JMNanpSlSXdQHCfhOCHiLV2uNqCqmtuSZe OgUTAokbBPlHkyVR3sbKMP8hO1n3WoLOqS++vDcvlKL4zWHc5s2ATI9qGLubul02EawF ybDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l7cMZFNb; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si3608860edc.194.2021.09.30.08.30.15; Thu, 30 Sep 2021 08:30:44 -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=@linuxfoundation.org header.s=korg header.b=l7cMZFNb; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343649AbhI3PXz (ORCPT + 99 others); Thu, 30 Sep 2021 11:23:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:53080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245746AbhI3PXy (ORCPT ); Thu, 30 Sep 2021 11:23:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C511619F5; Thu, 30 Sep 2021 15:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633015331; bh=vTC9XpMIezOW60s/XoQhUiiW+kLVovvfcyRZzf38HDg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l7cMZFNbhRQu7cWh4/WipIQAlIGjMGCheF/r6sFhE9SFaJJEfb2b1w7Lps4IMFJh9 sj+qpR5lK46YjOXFeZje9llX1xx9/n6cIUKm1auP86AevxxbdgkuXFWmiEQH7r/v/B RHyykNSDllod/OwwT4gDNSNtRhwjzkWWRGtz5JDc= Date: Thu, 30 Sep 2021 17:22:09 +0200 From: Greg Kroah-Hartman To: "Michael S. Tsirkin" Cc: Kuppuswamy Sathyanarayanan , Borislav Petkov , x86@kernel.org, Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Mika Westerberg , Jonathan Corbet , Jason Wang , Dan Williams , Andi Kleen , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices Message-ID: References: <20210930010511.3387967-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930010511.3387967-3-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930065807-mutt-send-email-mst@kernel.org> <20210930103537-mutt-send-email-mst@kernel.org> <20210930105852-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210930105852-mutt-send-email-mst@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 11:00:07AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 30, 2021 at 04:49:23PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Sep 30, 2021 at 10:38:42AM -0400, Michael S. Tsirkin wrote: > > > On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > > > > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > > > > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan wrote: > > > > > > While the common case for device-authorization is to skip probe of > > > > > > unauthorized devices, some buses may still want to emit a message on > > > > > > probe failure (Thunderbolt), or base probe failures on the > > > > > > authorization status of a related device like a parent (USB). So add > > > > > > an option (has_probe_authorization) in struct bus_type for the bus > > > > > > driver to own probe authorization policy. > > > > > > > > > > > > Reviewed-by: Dan Williams > > > > > > Signed-off-by: Kuppuswamy Sathyanarayanan > > > > > > > > > > > > > > > > > > > > So what e.g. the PCI patch > > > > > https://lore.kernel.org/all/CACK8Z6E8pjVeC934oFgr=VB3pULx_GyT2NkzAogdRQJ9TKSX9A@mail.gmail.com/ > > > > > actually proposes is a list of > > > > > allowed drivers, not devices. Doing it at the device level > > > > > has disadvantages, for example some devices might have a legacy > > > > > unsafe driver, or an out of tree driver. It also does not > > > > > address drivers that poke at hardware during init. > > > > > > > > Doing it at a device level is the only sane way to do this. > > > > > > > > A user needs to say "this device is allowed to be controlled by this > > > > driver". This is the trust model that USB has had for over a decade and > > > > what thunderbolt also has. > > > > > > > > > Accordingly, I think the right thing to do is to skip > > > > > driver init for disallowed drivers, not skip probe > > > > > for specific devices. > > > > > > > > What do you mean by "driver init"? module_init()? > > > > > > > > No driver should be touching hardware in their module init call. They > > > > should only be touching it in the probe callback as that is the only > > > > time they are ever allowed to talk to hardware. Specifically the device > > > > that has been handed to them. > > > > > > > > If there are in-kernel PCI drivers that do not do this, they need to be > > > > fixed today. > > > > > > > > We don't care about out-of-tree drivers for obvious reasons that we have > > > > no control over them. > > > > > > > > thanks, > > > > > > > > greg k-h > > > > > > Well talk to Andi about it pls :) > > > https://lore.kernel.org/r/ad1e41d1-3f4e-8982-16ea-18a3b2c04019%40linux.intel.com > > > > As Alan said, the minute you allow any driver to get into your kernel, > > it can do anything it wants to. > > > > So just don't allow drivers to be added to your kernel if you care about > > these things. The system owner has that mechanism today. > > > > thanks, > > > > greg k-h > > The "it" that I referred to is the claim that no driver should be > touching hardware in their module init call. Andi seems to think > such drivers are worth working around with a special remap API. Andi is wrong.