From: Thomas Gleixner <tglx@linutronix.de>
To: John Hubbard <jhubbard@nvidia.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
john.hubbard@gmail.com, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
x86@kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] x86/boot: clear some fields explicitly
Date: Fri, 26 Jul 2019 09:43:27 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1907260923370.1791@nanos.tec.linutronix.de> (raw)
In-Reply-To: <ffd7a9b6-8017-2d2c-c4f7-65563094ccd0@nvidia.com>
On Thu, 25 Jul 2019, John Hubbard wrote:
> On 7/25/19 3:28 PM, H. Peter Anvin wrote:
> > On 7/25/19 3:03 PM, Thomas Gleixner wrote:
> >> On Thu, 25 Jul 2019, hpa@zytor.com wrote:
> >>> On July 25, 2019 2:48:30 PM PDT, Thomas Gleixner <tglx@linutronix.de> wrote:
> >>>>
> >>>> But seriously I think it's not completely insane what they are doing
> >>>> and the table based approach is definitely more readable and maintainable
> >>>> than the existing stuff.
> >>>
> >>> Doing this table based does seem like a good idea.
> >>
> >> The question is whether we use a 'toclear' table or a 'preserve' table. I'd
> >> argue that the 'preserve' approach is saner.
> >>
> >
> > I agree.
> >
>
> OK, I can polish up something and post it, if you can help me with one more
> quick question: how did you want "to preserve" to work?
>
> a) copy out fields to preserve, memset the area to zero, copy back preserved
> fields? This seems like it would have the same gcc warnings as we have now,
> due to the requirement to memset a range of a struct...
Use the same trick I used for the toclear variant.
#define PRESERVE(m) \
{ \
.start = offsetof(m), \
.len = sizeof(m), \
}
sanitize_boot_params(bp, scratch)
{
char *p1 = bp, *p2 = scratch;
preserve[] = {
PRESERVE(member1),
...
PRESERVE(memberN),
};
for_each_preserve(pr)
memcpy(p2 + pr->start, p1 + pr->start, pr->len)
memcpy(bp, scratch, ...);
}
Thanks,
tglx
next prev parent reply other threads:[~2019-07-26 7:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-24 23:15 [PATCH 0/1] x86/boot: clear some fields explicitly john.hubbard
2019-07-24 23:15 ` [PATCH 1/1] " john.hubbard
2019-07-25 2:12 ` hpa
2019-07-25 6:49 ` John Hubbard
2019-07-25 7:22 ` Thomas Gleixner
2019-07-25 20:33 ` John Hubbard
2019-07-25 21:48 ` Thomas Gleixner
2019-07-25 21:57 ` hpa
2019-07-25 22:03 ` Thomas Gleixner
2019-07-25 22:28 ` H. Peter Anvin
2019-07-25 22:37 ` Thomas Gleixner
2019-07-26 0:36 ` John Hubbard
2019-07-25 22:42 ` John Hubbard
2019-07-26 7:43 ` Thomas Gleixner [this message]
2019-07-25 20:38 ` H. Peter Anvin
2019-07-25 20:44 ` John Hubbard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.1907260923370.1791@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jhubbard@nvidia.com \
--cc=john.hubbard@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).