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] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXD48GWiEJGiU8Gi@tzungbi-laptop>
Date: Thu, 22 Jan 2026 00:04:00 +0800
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: Bartosz Golaszewski <brgl@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] revocable: Remove redundant synchronize_srcu() call

On Wed, Jan 21, 2026 at 03:18:12PM +0000, Bartosz Golaszewski wrote:
> On Wed, 21 Jan 2026 13:34:15 +0100, Tzung-Bi Shih <tzungbi@...nel.org> said:
> > On Wed, Jan 21, 2026 at 11:38:18AM +0100, Bartosz Golaszewski wrote:
> >> On Wed, Jan 21, 2026 at 5:03 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
> >> >
> >> > When allocating a revocable provider via revocable_provider_alloc(),
> >> > there is no revocable consumers (i.e., RCU readers) yet.  Remove the
> >> > redundant synchronize_srcu() call to save cycles.
> >> >
> >> > Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
> >> > ---
> >> > To address the performance impact reported in
> >> > https://lore.kernel.org/linux-gpio/CAMRc=McrFa42mNWmZtD1HKKKZ+USUKpQAAME50wbfxPM7L72gA@mail.gmail.com/.
> >> >
> >> >  drivers/base/revocable.c | 1 -
> >> >  1 file changed, 1 deletion(-)
> >> >
> >> > diff --git a/drivers/base/revocable.c b/drivers/base/revocable.c
> >> > index f6cece275aac..b068e18a847d 100644
> >> > --- a/drivers/base/revocable.c
> >> > +++ b/drivers/base/revocable.c
> >> > @@ -99,7 +99,6 @@ struct revocable_provider *revocable_provider_alloc(void *res)
> >> >
> >> >         init_srcu_struct(&rp->srcu);
> >> >         rcu_assign_pointer(rp->res, res);
> >> > -       synchronize_srcu(&rp->srcu);
> >> >         kref_init(&rp->kref);
> >> >
> >> >         return rp;
> >> > --
> >> > 2.52.0.457.g6b5491de43-goog
> >> >
> >>
> >> Do you have an up-to-date integration branch with all the series and
> >> fixes you posted that I could use for testing with GPIO?
> >
> > Please use
> > https://git.kernel.org/pub/scm/linux/kernel/git/tzungbi/chrome-platform.git/log/?h=gpio_rev
> > for the purpose which is based on driver-core-next and gpio/for-current
> > branches.
> >
> 
> With this branch, I'm seeing the following KASAN splat when running libgpiod
> tests:
> 
> ==================================================================
> BUG: KASAN: use-after-free in notifier_call_chain+0x222/0x270
> Read of size 8 at addr ffff888103ce6490 by task gpiod-test/479
> 
> CPU: 2 UID: 0 PID: 479 Comm: gpiod-test Not tainted
> 6.19.0-rc6-yocto-standard+ #2 PREEMPT(full)
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
> rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014
> Call Trace:
>  <TASK>
>  dump_stack_lvl+0x63/0x90
>  print_report+0x153/0x4c7
>  ? __virt_addr_valid+0x225/0x4c0
>  ? kasan_addr_to_slab+0x11/0x80
>  kasan_report+0x103/0x140
>  ? notifier_call_chain+0x222/0x270
>  ? notifier_call_chain+0x222/0x270
>  __asan_report_load8_noabort+0x18/0x20
>  notifier_call_chain+0x222/0x270
>  blocking_notifier_call_chain+0x70/0xb0
>  gpiolib_cdev_unregister+0x5a/0x70
>  gpiochip_remove+0x48e/0x5a0

Weird, I didn't see the same error.  What I roughly tried:

(host) $ git checkout origin/gpio_rev
(host) $ cat myconfig
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_KASAN=y
(host) $ vng -k --config tools/testing/selftests/gpio/config \
         --config myconfig
(host) $ vng -b
(host) $ vng --user root

(vng) $ zgrep CONFIG_KASAN= /proc/config.gz
CONFIG_KASAN=y
(vng) $ ./libgpiod-2.2.2/tests/gpiod-test
TAP version 14
...
ok 1 /gpiod/chip/open_chip_good
ok 2 /gpiod/chip/open_chip_nonexistent
ok 3 /gpiod/chip/open_chip_not_a_character_device
...
ok 104 /gpiod/request-config/default_config
ok 105 /gpiod/request-config/set_consumer
ok 106 /gpiod/request-config/set_event_buffer_size
(vng) $ dmesg


Did I miss any configurations?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ