History

rseq: Introduce feature size and alignment ELF auxiliary vector entries

Export the rseq feature size supported by the kernel as well as the required allocation alignment for the rseq per-thread area to user-space through ELF auxiliary vector entries. This is part of the extensible rseq ABI.

Mathieu Desnoyers committed 3 years ago

Commit 317c8191 parent 4842dad3 files · +12 −0Browse files

Unified · Split

3 files
  1. fs/binfmt_elf.c +5 −0
  2. include/uapi/linux/auxvec.h +2 −0
  3. include/uapi/linux/rseq.h +5 −0
fs/binfmt_elf.c+5−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
46#include <linux/cred.h>46#include <linux/cred.h>
47#include <linux/dax.h>47#include <linux/dax.h>
48#include <linux/uaccess.h>48#include <linux/uaccess.h>
49#include <linux/rseq.h>
49#include <asm/param.h>50#include <asm/param.h>
50#include <asm/page.h>51#include <asm/page.h>
51 52
@@ -288,6 +289,10 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, · 236 unmodified lines
288 if (bprm->have_execfd) {289 if (bprm->have_execfd) {
289 NEW_AUX_ENT(AT_EXECFD, bprm->execfd);290 NEW_AUX_ENT(AT_EXECFD, bprm->execfd);
290 }291 }
292#ifdef CONFIG_RSEQ
293 NEW_AUX_ENT(AT_RSEQ_FEATURE_SIZE, offsetof(struct rseq, end));
294 NEW_AUX_ENT(AT_RSEQ_ALIGN, __alignof__(struct rseq));
295#endif
291#undef NEW_AUX_ENT296#undef NEW_AUX_ENT
292 /* AT_NULL is zero; clear the rest too */297 /* AT_NULL is zero; clear the rest too */
293 memset(elf_info, 0, (char *)mm->saved_auxv +298 memset(elf_info, 0, (char *)mm->saved_auxv +
include/uapi/linux/auxvec.h+2−0
@@ -30,6 +30,8 @@ · 29 unmodified lines
30 * differ from AT_PLATFORM. */30 * differ from AT_PLATFORM. */
31#define AT_RANDOM 25 /* address of 16 random bytes */31#define AT_RANDOM 25 /* address of 16 random bytes */
32#define AT_HWCAP2 26 /* extension of AT_HWCAP */32#define AT_HWCAP2 26 /* extension of AT_HWCAP */
33#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size */
34#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment */
33 35
34#define AT_EXECFN 31 /* filename of program */36#define AT_EXECFN 31 /* filename of program */
35 37
include/uapi/linux/rseq.h+5−0
@@ -130,6 +130,11 @@ struct rseq { · 129 unmodified lines
130 * this thread.130 * this thread.
131 */131 */
132 __u32 flags;132 __u32 flags;
133
134 /*
135 * Flexible array member at end of structure, after last feature field.
136 */
137 char end[];
133} __attribute__((aligned(4 * sizeof(__u64))));138} __attribute__((aligned(4 * sizeof(__u64))));
134 139
135#endif /* _UAPI_LINUX_RSEQ_H */140#endif /* _UAPI_LINUX_RSEQ_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t