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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Apr 2023 18:03:41 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     Thorsten Leemhuis <regressions@...mhuis.info>,
        James Bottomley <James.Bottomley@...senpartnership.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Peter Huewe <peterhuewe@....de>,
        Jason Gunthorpe <jgg@...pe.ca>, Jan Dabros <jsd@...ihalf.com>,
        regressions@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>,
        linux-integrity@...r.kernel.org,
        Dominik Brodowski <linux@...inikbrodowski.net>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Johannes Altmanninger <aclopte@...il.com>
Subject: Re: [REGRESSION] suspend to ram fails in 6.2-rc1 due to tpm errors

On Tue, Mar 14, 2023 at 04:23:54PM +0200, Jarkko Sakkinen wrote:
> > diff --git a/drivers/char/random.c b/drivers/char/random.c
> > index ce3ccd172cc8..708110c780aa 100644
> > --- a/drivers/char/random.c
> > +++ b/drivers/char/random.c
> > @@ -934,20 +934,20 @@ EXPORT_SYMBOL(add_device_randomness);
> >  void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy, bool sleep_after)
> >  {
> >  	mix_pool_bytes(buf, len);
> >  	credit_init_bits(entropy);
> > 
> >  	/*
> >  	 * Throttle writing to once every reseed interval, unless we're not yet
> >  	 * initialized or no entropy is credited.
> >  	 */
> > -	if (sleep_after && !kthread_should_stop() && (crng_ready() || !entropy))
> > -		schedule_timeout_interruptible(crng_reseed_interval());
> > +//	if (sleep_after && !kthread_should_stop() && (crng_ready() || !entropy))
> > +//		schedule_timeout_interruptible(crng_reseed_interval());
> >  }
> >  EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
> > 
> >  /*
> >   * Handle random seed passed by bootloader, and credit it depending
> >   * on the command line option 'random.trust_bootloader'.
> >   */
> >  void __init add_bootloader_randomness(const void *buf, size_t len)
> >  {
> > 
> > Then I hooked the tpm emulator up to qemu and put it in tpm1 mode. I had
> > userspace `echo mem > /sys/power/state` every couple of seconds (or
> > continuously maybe?), and then I used the qemu monitor interface to wake
> > the system from sleep. And kaboom.
> 
> Thanks for the tips! I'll try various patch combinations and see what
> happens.

I created a VM using libvirt with the following configuration [*]

<tpm model='tpm-tis'>
  <backend type='emulator' version='1.2'/>
  <alias name='tpm0'/>
</tpm>

I do not have issues with suspend so far with unmodified v6.3-rc7.

It would be nice to have a script that gives a guaranteed crash with
unmodified kernel even if run for some hours.

Instead of using QEMU monitor interface and /sys/power/state, I wonder
if a stress test could be based on looping rtcwake for easier comparison
of results?

[*] full description: https://gist.github.com/jarkkojs/66ea0d8d6a927311e8abb8b35e1ddbcd

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ