Re: [RFC]: mm,power: introduce MADV_WIPEONSUSPEND

Pavel Machek
2020-07-07T16:38:04Z

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

Hi!

> > > > You can do it seqlock-style, kind of - you reserve the first byte of
> > > > the page or so as a "is this page initialized" marker, and after every
> > > > read from the page, you do a compiler barrier and check whether that
> > > > byte has been cleared.
> > >
> > > This is certainly possible yet wery awkwar interface to use IMHO.
> > > MADV_EXTERNALY_VOLATILE would express the actual semantic much better.
> > > I might not still understand the expected usecase but if the target
> > > application has to be changed anyway then why not simply use a
> > > transparent and proper signaling mechanism like poll on a fd. That
> >
> > The goal is to have cryprographically-safe get_random_number() with 0
> > syscalls.
> >
> > You'd need to do:
> >
> > if (!poll(did_i_migrate)) {
> > use_prng_seed();
> > if (poll(did_i_migrate)) {
> > /* oops_they_migrated_me_in_middle_of_computation,
> > lets_redo_it() */
> > goto retry:
> > }
> > }
> >
> > Which means two syscalls..
>
> Is this a real problem though? Do we have any actual numbers? E.g. how
> often does the migration happen so that 2 syscalls would be visible in
> actual workloads?

Please go through the thread and try to understand it.

You'd need syscalls per get_randomness(), not per migration.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]