LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 19267 - Add a feature to clobber non-callee-save regs in the prolog/epilog or clobber dead callee-saves around call sites.
Summary: Add a feature to clobber non-callee-save regs in the prolog/epilog or clobber...
Status: NEW
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-27 16:42 PDT by Andrew Trick
Modified: 2014-04-02 21:09 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Trick 2014-03-27 16:42:11 PDT
Pretty simple. Just write some trash value into all registers in the prolog that aren't preserved by the function's calling convention.

We can add a function attribute to control this.
This feature could help stress test things like
- liveness across call site
- a managed runtime that saves/restores context around calls to native code
- the stack map liveness feature that reports 

In the case of stackmap liveness, we could clobber dead registers at the point of the stackmap to verify our own analysis. This would be a more direct way to verify the liveness analysis.

There is some speculation that this could harden code against security vulnerabilities, but I haven't confirmed that. 

For my immediate goals, verification in the runtime may be sufficient. But I want to float the idea early of having LLVM generate clobber regs to get input from others.
Comment 1 Andrew Trick 2014-03-27 17:00:19 PDT
To be clear, we can do this
(a) in the prolog for all caller-saves
(b) in the epilog for all caller-saves
(c) around call sites for dead callee-saves
Comment 2 Reid Kleckner 2014-03-27 18:34:05 PDT
FWIW, V8 and lots of JITs do this in debug modes, so it seems useful to me.