lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200722083425.GF3634@localhost>
Date:   Wed, 22 Jul 2020 10:34:25 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Johan Hovold <johan@...nel.org>, Pavel Machek <pavel@....cz>,
        linux-serial@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org,
        Jacek Anaszewski <jacek.anaszewski@...il.com>,
        kernel@...gutronix.de, Jiri Slaby <jslaby@...e.com>,
        linux-leds@...r.kernel.org, Dan Murphy <dmurphy@...com>
Subject: Re: [PATCH v7 3/3] leds: trigger: implement a tty trigger

On Tue, Jul 21, 2020 at 09:48:15PM +0200, Uwe Kleine-König wrote:
> Hello Johan,
> 
> On Tue, Jul 14, 2020 at 09:13:55AM +0200, Johan Hovold wrote:
> > On Tue, Jul 07, 2020 at 06:59:58PM +0200, Uwe Kleine-König wrote:
> > > +	while (firstrun ||
> > > +	       icount.rx != trigger_data->rx ||
> > > +	       icount.tx != trigger_data->tx) {
> > > +
> > > +		led_set_brightness(trigger_data->led_cdev, LED_ON);
> > > +
> > > +		msleep(100);
> > > +
> > > +		led_set_brightness(trigger_data->led_cdev, LED_OFF);
> > > +
> > > +		trigger_data->rx = icount.rx;
> > > +		trigger_data->tx = icount.tx;
> > > +		firstrun = false;
> > > +
> > > +		ret = tty_get_icount(trigger_data->tty, &icount);
> > > +		if (ret)
> > > +			return;
> > > +	}
> > 
> > Haven't looked at the latest proposal in detail, but this looks broken
> > as you can potentially loop indefinitely in a worker thread, and with no
> > way to stop the trigger (delayed work).
> 
> I don't think that potentially looping indefinitely is a problem, but
> indeed it should drop the lock during each iteration. Will think about
> how to adapt.

You musn't queue work that can run for long on the global shared
workqueue as it affects flushing:

	* system_wq is the one used by schedule[_delayed]_work[_on]().
	* Multi-CPU multi-threaded.  There are users which expect relatively
	* short queue flush time.  Don't queue works which can run for too
	* long.

Work that potentially run indefinitely is an absolute no-no. :)

Johan

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ