[PATCH] D12277: [X86] Add intrinsic support for clac, stac, lgdt and sgdt

Kuperstein, Michael M via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 23:45:44 PDT 2015


I don't think we can do better than a readwrite function call, really.

A readwrite function call ought to be a barrier to just about anything that reorders memory accesses, and if it's not enough - I don't think we have a stronger one available in the IR.
A volatile asm block should probably be equivalent, right?

-----Original Message-----
From: PaX Team [mailto:pageexec at gmail.com] 
Sent: Monday, August 24, 2015 22:09
To: Kuperstein, Michael M; david.majnemer at gmail.com; reviews+D12277+public+bff3e9012943ccc4 at reviews.llvm.org; Reid Kleckner
Cc: llvm-commits at lists.llvm.org
Subject: Re: [PATCH] D12277: [X86] Add intrinsic support for clac, stac, lgdt and sgdt

On 24 Aug 2015 at 16:30, Reid Kleckner via llvm-commit wrote:

> They have no constraints, which means they are equivalent to a normal 
> external function call. Isn't that enough of a barrier? I think most 
> users (kernels, hypervisors) are fine with LLVM reordering identified 
> object memory accesses across such a barrier.

i think the compiler must not reorder any memory accesses across any of lgdt/clac/stac as both the logical/virtual mappings (lgdt) and the access rights (clac/stac) may change for such memory accesses and cause misbehaviour (e.g., security bugs).

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the llvm-commits mailing list