x86-64-psABI: Add Intel LAM support

105 views
Skip to first unread message

H.J. Lu

unread,
Dec 22, 2020, 6:55:36 AM12/22/20
to x86-6...@googlegroups.com
LAM modifies the checking that is applied to 64-bit linear addresses,
allowing software to use of the untranslated address bits for metadata.

LAM_U48 (pointer bits in positions 62:48 are masked):

#define GNU_PROPERTY_X86_FEATURE_1_LAM_U48 (1U << 2)

LAM_U57 (pointer bits in positions 62:57 are masked):

#define GNU_PROPERTY_X86_FEATURE_1_LAM_U57 (1U << 3)

GNU_PROPERTY_X86_FEATURE_1_LAM_U48 implies
GNU_PROPERTY_X86_FEATURE_1_LAM_U57.
---
x86-64-ABI/abi.tex | 1 +
x86-64-ABI/dl.tex | 6 ++++
x86-64-ABI/lam.tex | 89 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+)
create mode 100644 x86-64-ABI/lam.tex

diff --git a/x86-64-ABI/abi.tex b/x86-64-ABI/abi.tex
index 37bfd53..30252ca 100644
--- a/x86-64-ABI/abi.tex
+++ b/x86-64-ABI/abi.tex
@@ -113,6 +113,7 @@ Version \version}}
\include{secure}
\include{mpx}
\include{cet}
+\include{lam}

\appendix
\include{kernel}
diff --git a/x86-64-ABI/dl.tex b/x86-64-ABI/dl.tex
index 04c273d..75e1e40 100644
--- a/x86-64-ABI/dl.tex
+++ b/x86-64-ABI/dl.tex
@@ -493,6 +493,8 @@ The following bits are defined for \code{GNU_PROPERTY_X86_FEATURE_1_AND}:
\hline
\texttt{GNU_PROPERTY_X86_FEATURE_1_IBT} & \texttt{1U << 0} \\
\texttt{GNU_PROPERTY_X86_FEATURE_1_SHSTK} & \texttt{1U << 1} \\
+ \texttt{GNU_PROPERTY_X86_FEATURE_1_LAM_U48} & \texttt{1U << 2} \\
+ \texttt{GNU_PROPERTY_X86_FEATURE_1_LAM_U57} & \texttt{1U << 3} \\
\end{tabular}
\end{center}
\Hrule
@@ -507,6 +509,10 @@ The following bits are defined for \code{GNU_PROPERTY_X86_FEATURE_1_AND}:
executable sections are compatible with SHSTK (see Section~\ref{shstk})
where return address popped from shadow stack always matches return
address popped from normal stack.
+ \item[GNU_PROPERTY_X86_FEATURE_1_LAM_U48] This indicates that all
+ sections are compatible with LAM_U48 (see Section~\ref{lam_u48}).
+ \item[GNU_PROPERTY_X86_FEATURE_1_LAM_U57] This indicates that all
+ sections are compatible with LAM_U57 (see Section~\ref{lam_u57}).
\end{description}

The following bits are defined for \code{GNU_PROPERTY_X86_ISA_1_USED}
diff --git a/x86-64-ABI/lam.tex b/x86-64-ABI/lam.tex
new file mode 100644
index 0000000..bcf4abc
--- /dev/null
+++ b/x86-64-ABI/lam.tex
@@ -0,0 +1,89 @@
+%%% vim:ai:tw=72:
+\chapter{Intel LAM Extension}
+
+\section{Intel LAM}
+
+Intel LAM (Linear Address Masking) Extension allows software to locate
+metadata in data pointers and dereference them without needing to mask
+the metadata bits. It supports:
+
+\begin{description}
+ \item[LAM_U48] Activate LAM for user data pointers and use of bits
+ 62:48 as masked metadata.
+ \item[LAM_U57] Activate LAM for user data pointers and use of bits
+ 62:57 as masked metadata.
+\end{description}
+
+\section{Program Loading}
+
+\subsection{Process \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48}}
+\label{lam_u48}
+
+On an LAM capable processor, the following steps should be taken:
+
+\begin{enumerate}
+ \item
+ \begin{sloppypar}
+ When loading an executable without interpreter, enable LAM_U48
+ if \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48} is set on the
+ executable.
+ \end{sloppypar}
+ \item
+ \begin{sloppypar}
+ When loading an executable with an interpreter, enable LAM_U48
+ if \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48} is set on the
+ interpreter. The interpreter should disable LAM_U48 if
+ \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48} isn't set on the
+ executable or any shared objects loaded via the \code{DT_NEEDED}
+ tag.
+ \end{sloppypar}
+ \item
+ \begin{sloppypar}
+ After LAM_U48 is enabled, when loading a shared object without
+ \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48}:
+ \begin{enumerate}
+ \item If legacy interwork is allowed, LAM_U48 should be disabled.
+ \item If legacy interwork isn't allowed, it causes an error.
+ \end{enumerate}
+ \end{sloppypar}
+\end{enumerate}
+
+\subsection{Process \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57}}
+\label{lam_u57}
+
+On an LAM capable processor, the following steps should be taken:
+
+\begin{enumerate}
+ \item
+ \begin{sloppypar}
+ When loading an executable without interpreter, enable LAM_U57
+ if \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57} is set on the
+ executable.
+ \end{sloppypar}
+ \item
+ \begin{sloppypar}
+ When loading an executable with an interpreter, enable LAM_U57
+ if \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57} is set on the
+ interpreter. The interpreter should disable LAM_U57 if
+ \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57} isn't set on the
+ executable or any shared objects loaded via the \code{DT_NEEDED}
+ tag.
+ \end{sloppypar}
+ \item
+ \begin{sloppypar}
+ After LAM_U57 is enabled, when loading a shared object without
+ \code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57}:
+ \begin{enumerate}
+ \item If legacy interwork is allowed, LAM_U57 should be disabled.
+ \item If legacy interwork isn't allowed, it causes an error.
+ \end{enumerate}
+ \end{sloppypar}
+\end{enumerate}
+
+\code{GNU_PROPERTY_X86_FEATURE_1_LAM_U48} implies
+\code{GNU_PROPERTY_X86_FEATURE_1_LAM_U57}.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "abi"
+%%% End:
--
2.29.2

xiang1...@intel.com

unread,
Dec 22, 2020, 7:29:56 PM12/22/20
to X86-64 System V Application Binary Interface
Seems this patch didn't base on https://gitlab.com/x86-psABIs/x86-64-ABI ?

H.J. Lu

unread,
Dec 22, 2020, 7:50:51 PM12/22/20
to xiang1...@intel.com, X86-64 System V Application Binary Interface
On Tue, Dec 22, 2020 at 4:29 PM xiang1...@intel.com
<xiang1...@intel.com> wrote:
>
> Seems this patch didn't base on https://gitlab.com/x86-psABIs/x86-64-ABI ?
>

The Intel LAM psABI is on usr/hjl/lam branch:

https://gitlab.com/x86-psABIs/x86-64-ABI/-/tree/usr/hjl/lam

--
H.J.
Reply all
Reply to author
Forward
0 new messages