linux-user: Create vdso_sigreturn_region_{start,end}
These variables will be populated from the vdso, and used for detecting whether we are executing the sigreturn. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
ab8008b231
commit
ee3b39c924
6 changed files with 22 additions and 2 deletions
|
|
@ -1659,6 +1659,11 @@ static void load_elf_vdso(struct image_info *info, const VdsoImageInfo *vdso)
|
||||||
if (vdso->rt_sigreturn_ofs) {
|
if (vdso->rt_sigreturn_ofs) {
|
||||||
default_rt_sigreturn = load_addr + vdso->rt_sigreturn_ofs;
|
default_rt_sigreturn = load_addr + vdso->rt_sigreturn_ofs;
|
||||||
}
|
}
|
||||||
|
if (vdso->sigreturn_region_start_ofs) {
|
||||||
|
vdso_sigreturn_region_start =
|
||||||
|
load_addr + vdso->sigreturn_region_start_ofs;
|
||||||
|
vdso_sigreturn_region_end = load_addr + vdso->sigreturn_region_end_ofs;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove write from VDSO segment. */
|
/* Remove write from VDSO segment. */
|
||||||
target_mprotect(info->start_data, info->end_data - info->start_data,
|
target_mprotect(info->start_data, info->end_data - info->start_data,
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,12 @@ static void elfN(search_symtab)(ElfN(Shdr) *shdr, unsigned sym_idx,
|
||||||
|
|
||||||
if (sigreturn_sym && strcmp(sigreturn_sym, name) == 0) {
|
if (sigreturn_sym && strcmp(sigreturn_sym, name) == 0) {
|
||||||
sigreturn_addr = sym.st_value;
|
sigreturn_addr = sym.st_value;
|
||||||
}
|
} else if (rt_sigreturn_sym && strcmp(rt_sigreturn_sym, name) == 0) {
|
||||||
if (rt_sigreturn_sym && strcmp(rt_sigreturn_sym, name) == 0) {
|
|
||||||
rt_sigreturn_addr = sym.st_value;
|
rt_sigreturn_addr = sym.st_value;
|
||||||
|
} else if (strcmp("sigreturn_region_start", name) == 0) {
|
||||||
|
sigreturn_region_start_addr = sym.st_value;
|
||||||
|
} else if (strcmp("sigreturn_region_end", name) == 0) {
|
||||||
|
sigreturn_region_end_addr = sym.st_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ static const char *rt_sigreturn_sym;
|
||||||
|
|
||||||
static unsigned sigreturn_addr;
|
static unsigned sigreturn_addr;
|
||||||
static unsigned rt_sigreturn_addr;
|
static unsigned rt_sigreturn_addr;
|
||||||
|
static unsigned sigreturn_region_start_addr;
|
||||||
|
static unsigned sigreturn_region_end_addr;
|
||||||
|
|
||||||
#define N 32
|
#define N 32
|
||||||
#define elfN(x) elf32_##x
|
#define elfN(x) elf32_##x
|
||||||
|
|
@ -215,6 +217,10 @@ int main(int argc, char **argv)
|
||||||
fprintf(outf, " .reloc_count = ARRAY_SIZE(%s_relocs),\n", prefix);
|
fprintf(outf, " .reloc_count = ARRAY_SIZE(%s_relocs),\n", prefix);
|
||||||
fprintf(outf, " .sigreturn_ofs = 0x%x,\n", sigreturn_addr);
|
fprintf(outf, " .sigreturn_ofs = 0x%x,\n", sigreturn_addr);
|
||||||
fprintf(outf, " .rt_sigreturn_ofs = 0x%x,\n", rt_sigreturn_addr);
|
fprintf(outf, " .rt_sigreturn_ofs = 0x%x,\n", rt_sigreturn_addr);
|
||||||
|
fprintf(outf, " .sigreturn_region_start_ofs = 0x%x,\n",
|
||||||
|
sigreturn_region_start_addr);
|
||||||
|
fprintf(outf, " .sigreturn_region_end_ofs = 0x%x,\n",
|
||||||
|
sigreturn_region_end_addr);
|
||||||
fprintf(outf, "};\n");
|
fprintf(outf, "};\n");
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@ typedef struct {
|
||||||
unsigned reloc_count;
|
unsigned reloc_count;
|
||||||
unsigned sigreturn_ofs;
|
unsigned sigreturn_ofs;
|
||||||
unsigned rt_sigreturn_ofs;
|
unsigned rt_sigreturn_ofs;
|
||||||
|
unsigned sigreturn_region_start_ofs;
|
||||||
|
unsigned sigreturn_region_end_ofs;
|
||||||
} VdsoImageInfo;
|
} VdsoImageInfo;
|
||||||
|
|
||||||
/* Note that both Elf32_Word and Elf64_Word are uint32_t. */
|
/* Note that both Elf32_Word and Elf64_Word are uint32_t. */
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
/* Fallback addresses into sigtramp page. */
|
/* Fallback addresses into sigtramp page. */
|
||||||
extern abi_ulong default_sigreturn;
|
extern abi_ulong default_sigreturn;
|
||||||
extern abi_ulong default_rt_sigreturn;
|
extern abi_ulong default_rt_sigreturn;
|
||||||
|
extern abi_ulong vdso_sigreturn_region_start;
|
||||||
|
extern abi_ulong vdso_sigreturn_region_end;
|
||||||
|
|
||||||
void setup_sigtramp(abi_ulong tramp_page);
|
void setup_sigtramp(abi_ulong tramp_page);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
|
||||||
/* Fallback addresses into sigtramp page. */
|
/* Fallback addresses into sigtramp page. */
|
||||||
abi_ulong default_sigreturn;
|
abi_ulong default_sigreturn;
|
||||||
abi_ulong default_rt_sigreturn;
|
abi_ulong default_rt_sigreturn;
|
||||||
|
abi_ulong vdso_sigreturn_region_start;
|
||||||
|
abi_ulong vdso_sigreturn_region_end;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System includes define _NSIG as SIGRTMAX + 1, but qemu (like the kernel)
|
* System includes define _NSIG as SIGRTMAX + 1, but qemu (like the kernel)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue