From: "H.J. Lu" <hjl.tools@gmail.com>
To: Richard Guenther <richard.guenther@gmail.com>,
Florian Weimer <fweimer@redhat.com>,
Rich Felker <dalias@libc.org>
Cc: "szabolcs.nagy" <szabolcs.nagy@arm.com>,
GCC Patches <gcc-patches@gcc.gnu.org>, nd <nd@arm.com>,
Uros Bizjak <ubizjak@gmail.com>
Subject: PATCH] x86: Add -mzero-caller-saved-regs=[skip|used-gpr|all-gpr|used|all]
Date: Wed, 31 Oct 2018 21:53:00 -0000 [thread overview]
Message-ID: <CAMe9rOoixj0ZbrpoC8bqSDsZEPudxmzpffw-aFwH+A7SboBRuQ@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc1OhYLaLVnPxOQfkQSsVRVhx6snUrvoDAs2movFd1veeQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2239 bytes --]
On Thu, Sep 27, 2018 at 7:58 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Thu, Sep 27, 2018 at 3:16 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Thu, Sep 27, 2018 at 6:08 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> > > On 26/09/18 19:10, H.J. Lu wrote:
> > >>
> > >> Add -mzero-caller-saved-regs=[skip|used|all] command-line option and
> > >> zero_caller_saved_regs("skip|used|all") function attribue:
> > >>
> > >> 1. -mzero-caller-saved-regs=skip and zero_caller_saved_regs("skip")
> > >>
> > >> Don't zero caller-saved integer registers upon function return.
> > >>
> > >> 2. -mzero-caller-saved-regs=used and zero_caller_saved_regs("used")
> > >>
> > >> Zero used caller-saved integer registers upon function return.
> > >>
> > >> 3. -mzero-caller-saved-regs=all and zero_caller_saved_regs("all")
> > >>
> > >> Zero all caller-saved integer registers upon function return.
> > >>
> > >> Tested on i686 and x86-64 with bootstrapping GCC trunk and
> > >> -mzero-caller-saved-regs=used as well as -mzero-caller-saved-regs=all
> > >> enabled by default.
> > >>
> > >
> > > from this description and the documentation it's
> > > not clear to me what this tries to achieve.
> > >
> > > is it trying to prevent information leak?
> > > or some pcs hack the caller may rely on?
> > >
> > > if it's for information leak then i'd expect such
> > > attribute to be used on crypto code.. however i'd
> > > expect crypto code to use simd registers as well,
> > > so integer only cleaning needs explanation.
> >
> > The target usage is in Linux kernel.
>
> Maybe still somehow encode that in the option since it otherwise raises
> expectations that are not met?
> -mzero-call-clobbered-regs=used-int|all-int|skip|used-simd|used-fp,etc.?
> and sorry() on unimplemented ones? Or simply zero also non-integer
> regs the same way? I suppose
> there isn't sth like vzeroupper that zeros all SIMD regs and completely?
>
Here is the updated patch to zero caller-saved vector registers. I don't
mind a different option name if it is preferred. I may be able to create
some generic utility functions which can be used by other backends. But
actual implementation must be target specific.
Any comments?
Thanks.
--
H.J.
[-- Attachment #2: 0001-x86-Add-mzero-caller-saved-regs-skip-used-gpr-all-gp.patch --]
[-- Type: application/x-patch, Size: 54949 bytes --]
next prev parent reply other threads:[~2018-10-31 19:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 18:11 RFC: [PATCH] x86: Add -mzero-caller-saved-regs=[skip|used|all] H.J. Lu
2018-09-27 11:01 ` Richard Biener
2018-09-27 13:08 ` H.J. Lu
2018-09-27 13:10 ` Szabolcs Nagy
2018-09-27 13:41 ` H.J. Lu
2018-09-27 15:13 ` Richard Biener
2018-09-27 19:41 ` H.J. Lu
2018-10-31 21:53 ` H.J. Lu [this message]
2018-11-29 23:16 ` PING [PATCH] x86: Add -mzero-caller-saved-regs=[skip|used-gpr|all-gpr|used|all] H.J. Lu
2018-12-21 13:23 ` PING^2 " H.J. Lu
2018-09-27 14:04 ` RFC: [PATCH] x86: Add -mzero-caller-saved-regs=[skip|used|all] Rich Felker
2018-09-27 20:07 ` H.J. Lu
2018-09-27 19:29 ` Florian Weimer
2018-09-27 19:51 ` H.J. Lu
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=CAMe9rOoixj0ZbrpoC8bqSDsZEPudxmzpffw-aFwH+A7SboBRuQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=dalias@libc.org \
--cc=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nd@arm.com \
--cc=richard.guenther@gmail.com \
--cc=szabolcs.nagy@arm.com \
--cc=ubizjak@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).