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-next>] [day] [month] [year] [list]
Message-ID: <20140220162754.GC15994@e102568-lin.cambridge.arm.com>
Date:	Thu, 20 Feb 2014 16:27:55 +0000
From:	Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To:	Sebastian Capella <sebastian.capella@...aro.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linaro-kernel@...ts.linaro.org" <linaro-kernel@...ts.linaro.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Russ Dill <Russ.Dill@...com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Russell King <linux@....linux.org.uk>,
	Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
	Nicolas Pitre <nico@...aro.org>,
	Santosh Shilimkar <santosh.shilimkar@...com>,
	Will Deacon <Will.Deacon@....com>,
	Cyril Chemparathy <cyril@...com>,
	Jonathan Austin <Jonathan.Austin@....com>,
	Catalin Marinas <Catalin.Marinas@....com>,
	Uwe Kleine-K?nig <u.kleine-koenig@...gutronix.de>,
	Stephen Boyd <sboyd@...eaurora.org>
Subject: Re: [PATCH RFC v1 3/3] ARM hibernation / suspend-to-disk

Hi Sebastian,

On Wed, Feb 19, 2014 at 07:33:15PM +0000, Sebastian Capella wrote:
> Quoting Lorenzo Pieralisi (2014-02-19 08:12:54)
> > On Wed, Feb 19, 2014 at 01:52:09AM +0000, Sebastian Capella wrote:
> > [...]
> > > diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
> > > new file mode 100644
> > > index 0000000..16f406f
> > > --- /dev/null
> > > +++ b/arch/arm/kernel/hibernate.c
> > > +void notrace save_processor_state(void)
> > > +{
> > > +     WARN_ON(num_online_cpus() != 1);
> > > +     flush_thread();
> > 
> > Can you explain to me please why we need to call flush_thread() here ?
> > At this point in time syscore_suspend() was already called and CPU
> > peripheral state saved through CPU PM notifiers.
> 
> Copying Russ' response here: 
> 
> "I think the idea here is to get the CPU into a state so that later
> when we resume from the resume kernel, the actual CPU state matches
> the state we have in kernel. The main thing flush_thread does is clear
> out any and all FP state." - Russ Dill

See my reply to Russ.

[...]

> > > +static void notrace __swsusp_arch_restore_image(void *unused)
> > > +{
> > > +     struct pbe *pbe;
> > > +
> > > +     cpu_switch_mm(idmap_pgd, &init_mm);
> > 
> > Same here, thanks.
> 
> At restore time, we take the save buffer data and restore it to the same
> physical locations used in the previous execution.  This will require having
> write access to all of memory, which may not be generally granted by the
> current mm.  So we switch to 1-1 init_mm to restore memory.

I still do not understand why switching to idmap, which is a clone of
init_mm + 1:1 kernel mappings is required here. Why idmap ?

And while at it, can't the idmap be overwritten _while_ copying back the
resume kernel ? Is it safe to use idmap page tables while copying ?

I had a look at x86 and there idmap page tables used to resume are created
on the fly using safe pages, on ARM idmap is created at boot.

I am grokking the code to understand what is really needed here, will get
back to you asap but I would like things to be clarified in the interim.

Thanks,
Lorenzo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ