git: 5d9f790191fe - main - Eliminate p_elf_machine from struct proc.
Dmitry Chagin
dchagin at FreeBSD.org
Tue Jun 29 17:20:24 UTC 2021
The branch main has been updated by dchagin:
URL: https://cgit.FreeBSD.org/src/commit/?id=5d9f790191fe7cd003e92f8b0fa93571d885bf5e
commit 5d9f790191fe7cd003e92f8b0fa93571d885bf5e
Author: Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-06-29 17:18:29 +0000
Commit: Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-06-29 17:18:29 +0000
Eliminate p_elf_machine from struct proc.
Instead of p_elf_machine use machine member of the Elf_Brandinfo which is now
cached in the struct proc at p_elf_brandinfo member.
Note to MFC: D30918, KBI
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30926
MFC after: 2 weeks
---
sys/kern/imgact_elf.c | 5 +++--
sys/kern/kern_thread.c | 2 +-
sys/sys/proc.h | 1 -
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 98ce5460e360..42d922e9f002 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -1333,7 +1333,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
imgp->reloc_base = addr;
imgp->proc->p_osrel = osrel;
imgp->proc->p_fctl0 = fctl0;
- imgp->proc->p_elf_machine = hdr->e_machine;
imgp->proc->p_elf_flags = hdr->e_flags;
ret:
@@ -1806,8 +1805,10 @@ __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs,
Elf_Phdr *phdr;
Elf_Shdr *shdr;
struct phdr_closure phc;
+ Elf_Brandinfo *bi;
ehdr = (Elf_Ehdr *)hdr;
+ bi = td->td_proc->p_elf_brandinfo;
ehdr->e_ident[EI_MAG0] = ELFMAG0;
ehdr->e_ident[EI_MAG1] = ELFMAG1;
@@ -1820,7 +1821,7 @@ __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs,
ehdr->e_ident[EI_ABIVERSION] = 0;
ehdr->e_ident[EI_PAD] = 0;
ehdr->e_type = ET_CORE;
- ehdr->e_machine = td->td_proc->p_elf_machine;
+ ehdr->e_machine = bi->machine;
ehdr->e_version = EV_CURRENT;
ehdr->e_entry = 0;
ehdr->e_phoff = sizeof(Elf_Ehdr);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 3afcf2d3f0ef..7d971d295cba 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -120,7 +120,7 @@ _Static_assert(offsetof(struct proc, p_filemon) == 0x268,
"struct proc KBI p_filemon");
_Static_assert(offsetof(struct proc, p_comm) == 0x27c,
"struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x30c,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x308,
"struct proc KBI p_emuldata");
#endif
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 36c07b3b5e78..19e8d76c6f99 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -700,7 +700,6 @@ struct proc {
pid_t p_reapsubtree; /* (e) Pid of the direct child of the
reaper which spawned
our subtree. */
- uint16_t p_elf_machine; /* (x) ELF machine type */
uint64_t p_elf_flags; /* (x) ELF flags */
void *p_elf_brandinfo; /* (x) Elf_Brandinfo, NULL for
non ELF binaries. */
More information about the dev-commits-src-all
mailing list