From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C732451EE1D; Tue, 22 Sep 2026 21:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790111127; cv=none; b=mPNA8SVif7mOa9d3B1KySrj911KdgTtgt4JGCcwa2I2PnKZJWZXP7QqAWtTWpd9f6PCnaCfOW4zP4Rb5mzZDJPBALlQ+ePjWPB2OfmHnlKnXwg9rt3e893MEZUODBDWiTy0zSHXEjvYfNYrghTXfS9TnVpPDhMajl1W+T8geJ68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790111127; c=relaxed/simple; bh=9Dv0Y/BGh3R8PeSvjophk2YPpeulfdBgLbKzqOhLo4Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pEApja8Rw1sEdn0ls2fozz/1domfambFEQAFTUGpRVdZpAh+DTlMEVJETUCTaKkiF1dD89AE3Q9FZ1vLTjBzsEzJv5Dy0pplyox0Xv+gk1/jlboz/w9K0x4YH0+ew1EpHmUIP+rGWd0mU4bx5H+ljbeVAZ66GkmeBgP7iZmTU3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=BVPf6FMy; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="BVPf6FMy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1790111089; x=1790715889; i=w_armin@gmx.de; bh=HPj6QE4B/HefE3yLab3sUv06uJRi8t/2qBCqZDYS9/A=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=BVPf6FMyTeIyxJMRjkg4iy0eYXktcUzQwdvMkeZ7WJAxtCckYxOGRZ3tTnvXwj5J +MhhbNRexm4GKX7XJxofDjMyztapU8G93s33wGkwg758e/YJxMqfr7g1CTlV5xWCn 9gtodpcZWuMtHXc4IepVXto86qHxeo/p6kN6+msHm/334a5uXA7oG1rP2tXvbD+yd mw5fG7rCLZNlbwug98cynB5QYfy0ovFIxss11iE+AMOYY39/3OdTd+5wHCpNpLf+B 59EYHM+UkKCPoOPGOAj7pWftPeVvQO+oHd9yZhW5DRZIPWmb/wmFYVK5W7/oPb0uw 0umH3cvZ6h0J6AQb2A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from client.hidden.invalid by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHoRA-1wwSD040xC-00HAHh; Tue, 22 Sep 2026 23:04:49 +0200 Message-ID: <9bd3a34b-5e98-4038-80d6-da2c3b1948dd@gmx.de> Date: Tue, 22 Sep 2026 23:04:46 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 0/3] driver core: add TAINT_FORCED_BIND for when userspace manually messes with devices and drivers To: David Lechner , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Danilo Krummrich Cc: Greg Kroah-Hartman , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Jonathan Corbet , Shuah Khan , Randy Dunlap , "Rafael J. Wysocki" , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Bradley Morgan , Aleksandr Nogikh , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-usb@vger.kernel.org, driver-core@lists.linux.dev, linux-trace-kernel@vger.kernel.org, Johan Hovold , Richard Weinberger References: <20260914-bind_taint-v4-0-eadf8a090903@linuxfoundation.org> Content-Language: en-US From: Armin Wolf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:WC7Q3H3s8ZsHb6GZdlAH2xhbLNtKPMe9amNYtSfQcE1J7vdyDAD oaZxnVdrivGNmsT1JMOr3xUOZQxBJ8xLk6rh2KvA9bA8/6tc+D+LysIS906O/DpMgKS+ktn l1Kdz2RqzTEneLk5opZq55AEXwMmUeKoQ/eku4K1a3dtOjllrJ1SIufdF46AndHkdZsK7TY 1YrgmsEz6BLYETy1qazqg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:PuQ2TbBFUU0=;SPWpip2IlpAv3IU5dtJ3vj3wwSh mWEFIf5PZIEMGoAtF2eh2aZnPwv/3W2IzK2zspl2NPE3vfCu0rnEaIbHwXMrufXtM1M1eJ+WI iR0AawKQzrh1W5YwTqvwq+smK/K7BtsswG6aZjMbPyjmqGwaK1URdq3KnAZoK3N+AqvTClnJ2 OsrUSxLLg9zna66m2DLUVDeUdY4ZL+3voCgT218TF0bpCKUqYgr0wERw3elcwYxhMaxFxeTl2 VzHpHGROrizy3uB53ha0Otw4x1Vf2wVuUf4/u2/x6sh4Cj5lOHKmUoFJWn9Ap4GUL+bCxzmh4 j0MvtrwGMLzeej2MSb9woVSdXRbi8So3IOXGZgNejDk8if+BVYUyYb6i1wBXjPt3WOInaztob Au2+hZfRBWIDq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999f2jEA5AYcICCbwXC xUnBknAxkYCkp0V3le2Z+MV5MFaZ8sxNrrNGjOthuKNDF5OhVTx9jdZmyKQodQ298QobLp+2M xWGN/1H5D24ch7Z4qwff6cWy8q92xOUKa5zhmeLem9pEy+D3xjJa7P+KxGqWs98c4YX83cpH+ RIDclSdPs7EdPTyV+cQ9emossCQnjHtrCVKJAarS9cdNjWvzrEDq1NUPu0fqZBzS7RMhQ+hAv EigDKROk1RwhmLWWByC9Tvg9qsigpPGRPqpF8tBhkruB+8lHISNpaeDgrvzSjQpyu9jG4fpgX N6IlU8Lx64EpITFhw1oPkSuI1ncqbAzBr2lOU6MpAhqQ1ysgwVEHNJLMAU/O5XZbBDQJnlE+3 VXZm1gU0XeLGG5jHqU7Rtnbd3Ix1oWfOPsoOuusfWtw2KcAyGJZ7tyZKMFbCa1bbrOxxq1FJL gnZQ/gdLMzUVI5ErJ3l+cls9HN/ngyBGqdChm5hoAoadHXgrUS22bFSkVJ8dvkqzCCcze4ckS Tu3bZHucahmk4qA2NTs5/3o2vY+h71uLMfofFJZ9glK1VaklzotsjUoVHj4qu8zzDVEfwlsH0 VKRtgDFJIT0wWcnN8BAfSw7Y1y+eOOfJ717ku0TufC0sVlp1BJt/k4xnk0ALUVB/ysUQVqZMA NNcojz3ZwxYyD1OkzUZ4DdcScb0mS8MA1iT1VD65hX6dwVu5PDbPUPHPkvfaUXvNN+6EbAhW4 Mbz06IpVbstePJ/LEY8LXhgweA== Am 22.09.26 um 15:40 schrieb David Lechner: > On 9/22/26 2:39 AM, Uwe Kleine-K=C3=B6nig wrote: >> On Fri, Sep 18, 2026 at 06:39:02PM +0200, Danilo Krummrich wrote: >>> On Mon Sep 14, 2026 at 4:30 PM CEST, Greg Kroah-Hartman wrote: >>>> The ability to add and remove devices from a driver through the sysfs >>>> "bind" and "unbind" files was created all those decades ago as a way >>>> that kernel developers can iterate faster, and provide a debugging wa= y >>>> for users to attempt to add a new device to a driver without having t= o >>>> rebuild their kernel. >>>> >>>> This api over the years has been abused and recently come under a maj= or >>>> fuzzing "attack" through tools like syzbot which decided that it woul= d >>>> attempt to just randomly bind any driver to any type of device, causi= ng >>>> loads of unneeded errors and pointless kernel patches to be generated= by >>>> unsuspecting new developers. >>>> >>>> Handle all of this by adding a new taint flag, TAINT_FORCED_BIND, whi= ch >>>> will be set on the driver if the bind/unbind sysfs files are ever >>>> written to. This lets kernel developers "know" that a user is >>>> attempting to do something that is not normal, and as such, if the >>>> kernel breaks they get to keep the shiny pieces laying around on the >>>> floor. >>>> >>>> The flag is 'Y' which was unused, and can remembered as the user is >>>> "yeeting" the device being operated on here (thrown with force withou= t >>>> regard for the thing being thrown). >>>> >>>> Note, the taint flag gets set _BEFORE_ the bind/unbind callback happe= ns, >>>> as many times crashes/oops/warnings/failures happen within the callba= ck, >>>> and the taint flag needs to be there to show what was being attempted= . >>>> If it were to be set after the callback happens, the oops report woul= d >>>> not properly reflect what foolishness was being attempted. >>>> >>>> Fuzzing tools like syzbot, that doesn't have hand-crafted rules to ke= ep >>>> the tool from hitting bind/unbind, should be run with panic_on_taint >>>> enabled so that they fall over and don't continue on, thinking that t= hey >>>> actually found a real issue. >>>> >>>> Userspace operations that rely on the bind/unbind files >>> I agree that this should be avoided. >>> >>> But I also think the biggest offender really is driver_override. Speci= fically, >>> on a hot-pluggable bus a driver must be complient with the device driv= er >>> lifecycle rules and hence shouldn't break on bind/unbind. I think it w= ould be >>> nice to not taint the kernel for such busses, and only taint on driver= _override, >>> as I think we'd still want the bug reports for such cases. >>> >>> But I think this is fine to leave for a follow-up. >> I fully agree. I'm fine and support tainting on driver_override, but >> bind/unbind are used occasionally in my bubble and I consider drivers >> not handling that properly buggy. I fully agree with this, drivers should correctly implement the lifecycle = model and not just break when being unbound at a improper time. Drivers sufferin= g from this can easily break this way when unloading the associated kernel module= , so this taint is no solution. > In the IIO subsystem, unbind/rebind is the de-facto way to reset a wedge= d > chip. > > A few examples where other reset methods were reject in favor of unbind/= bind: > > https://lore.kernel.org/linux-iio/20240727160216.2488ed29@jic23-huawei/ > > This needs documenting as it's custom ABI. Note that we don't often > accept custom ABI. Particularly not a hook that seems to reset the > device. If you want to do that, unbind and rebind the whole drive[r] > so we are in a known state etc. > > https://lore.kernel.org/linux-iio/20240720163440.03c713dc@jic23-huawei/ > > Firstly as stated below, we don't provide interfaces for this > because it's a heavy weight process that is most of the effort of > unbinding and rebinding the driver. So if you need to reset, do that. > > https://lore.kernel.org/linux-iio/20250505200609.54756520@jic23-huawei/ > > The solution is to run it once at driver bind. Similar to reset > below, if the usecase needs to re do it then unbinding and rebinding > the driver reflects the fact we are taking it effectively offline > for a while. > I also consider bind/unbind to be an official API to interact with devices= , so i want to use them in the future with the WMI subsystem. AFAIK the underlying reason for this series is that some drivers break whe= n being bound to unsupported devices. However IMHO drivers should verify tha= t they support a given device inside their .probe callback, and the associat= ed bus should only match devices with drivers that explicitly claim support f= or those devices (ignoring driver_override). Can we get some example bugs uncovered this way? Thanks, Armin Wolf >> So please let's do >> >> diff --git a/drivers/base/bus.c b/drivers/base/bus.c >> index c51ad96d4de4..ce8fb14ea19a 100644 >> --- a/drivers/base/bus.c >> +++ b/drivers/base/bus.c >> @@ -242,7 +242,6 @@ static ssize_t unbind_store(struct device_driver *d= rv, const char *buf, >> =20 >> dev =3D bus_find_device_by_name(bus, NULL, buf); >> if (dev && dev->driver =3D=3D drv) { >> - add_taint_module(drv->owner, TAINT_FORCED_BIND, LOCKDEP_STILL_OK); >> device_driver_detach(dev); >> err =3D count; >> } >> @@ -266,7 +265,6 @@ static ssize_t bind_store(struct device_driver *drv= , const char *buf, >> =20 >> dev =3D bus_find_device_by_name(bus, NULL, buf); >> if (dev && driver_match_device(drv, dev)) { >> - add_taint_module(drv->owner, TAINT_FORCED_BIND, LOCKDEP_STILL_OK); >> err =3D device_driver_attach(drv, dev); >> if (!err) { >> /* success */ >> @@ -513,6 +511,7 @@ static ssize_t driver_override_store(struct device = *dev, >> { >> int ret; >> =20 >> + add_taint_module(drv->owner, TAINT_FORCED_BIND, LOCKDEP_STILL_OK); >> ret =3D __device_set_driver_override(dev, buf, count); >> if (ret) >> return ret; >> >> (plus the needed documentation adaptions and maybe a rename >> s/TAINT_FORCED_BIND/TAINT_DRIVER_OVERRIDE/). >> >> Best regards >> Uwe