mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
[PowerPC][Book-E] Fix missing load base in elf_cpu_parse_dynamic().
When I implemented MD DYNAMIC parsing, I was originally passing a linker_file_t so that the MD code could relocate pointers. However, it turns out this isn't even filled in until later, so it was always 0. Just pass the load base (ef->address) directly, as that's really the only thing we were interested in in the first place. This fixes a crash on RB800 where it was trying to write to an unmapped address when updating the GOT. Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D24105
This commit is contained in:
parent
0a70e97c94
commit
3069380898
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359062
|
@ -331,7 +331,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -327,7 +327,7 @@ elf_cpu_load_file(linker_file_t lf)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -258,7 +258,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -297,7 +297,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -620,7 +620,7 @@ parse_dynamic(elf_file_t ef)
|
|||
ef->ddbstrtab = ef->strtab;
|
||||
ef->ddbstrcnt = ef->strsz;
|
||||
|
||||
return elf_cpu_parse_dynamic(&ef->lf, ef->dynamic);
|
||||
return elf_cpu_parse_dynamic(ef->address, ef->dynamic);
|
||||
}
|
||||
|
||||
#define LS_PADDING 0x90909090
|
||||
|
|
|
@ -503,7 +503,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -403,7 +403,7 @@ ppc32_runtime_resolve()
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf, Elf_Dyn *dynamic)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase, Elf_Dyn *dynamic)
|
||||
{
|
||||
Elf_Dyn *dp;
|
||||
bool has_plt = false;
|
||||
|
@ -414,7 +414,7 @@ elf_cpu_parse_dynamic(linker_file_t lf, Elf_Dyn *dynamic)
|
|||
switch (dp->d_tag) {
|
||||
case DT_PPC_GOT:
|
||||
secure_plt = true;
|
||||
got = (Elf_Addr *)(lf->address + dp->d_un.d_ptr);
|
||||
got = (Elf_Addr *)(loadbase + dp->d_un.d_ptr);
|
||||
/* Install runtime resolver canary. */
|
||||
got[1] = (Elf_Addr)ppc32_runtime_resolve;
|
||||
got[2] = (Elf_Addr)0;
|
||||
|
|
|
@ -416,7 +416,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -506,7 +506,7 @@ elf_cpu_unload_file(linker_file_t lf __unused)
|
|||
}
|
||||
|
||||
int
|
||||
elf_cpu_parse_dynamic(linker_file_t lf __unused, Elf_Dyn *dynamic __unused)
|
||||
elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -305,7 +305,7 @@ int linker_ctf_get(linker_file_t, linker_ctf_t *);
|
|||
|
||||
int elf_cpu_load_file(linker_file_t);
|
||||
int elf_cpu_unload_file(linker_file_t);
|
||||
int elf_cpu_parse_dynamic(linker_file_t, Elf_Dyn *);
|
||||
int elf_cpu_parse_dynamic(caddr_t, Elf_Dyn *);
|
||||
|
||||
/* values for type */
|
||||
#define ELF_RELOC_REL 1
|
||||
|
|
Loading…
Reference in a new issue