|
1 | 1 | /* |
2 | | - * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
31 | 31 | #include <elf.h> |
32 | 32 | #include <link.h> |
33 | 33 | #include <errno.h> |
34 | | -#include <sys/mman.h> |
35 | | -#include <sys/sendfile.h> |
36 | | -#include <sys/utsname.h> |
37 | 34 | #include "libproc_impl.h" |
38 | 35 | #include "ps_core_common.h" |
39 | 36 | #include "proc_service.h" |
@@ -288,8 +285,6 @@ static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) { |
288 | 285 | // We will adjust it in read_exec_segments(). |
289 | 286 | ph->core->dynamic_addr = auxv->a_un.a_val; |
290 | 287 | break; |
291 | | - } else if (auxv->a_type == AT_SYSINFO_EHDR) { |
292 | | - ph->core->vdso_addr = auxv->a_un.a_val; |
293 | 288 | } |
294 | 289 | auxv++; |
295 | 290 | } |
@@ -355,10 +350,6 @@ static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) { |
355 | 350 | print_error("failed to add map info\n"); |
356 | 351 | goto err; |
357 | 352 | } |
358 | | - if (core_php->p_vaddr == ph->core->vdso_addr) { |
359 | | - ph->core->vdso_offset = core_php->p_offset; |
360 | | - ph->core->vdso_size = core_php->p_memsz; |
361 | | - } |
362 | 353 | } |
363 | 354 | break; |
364 | 355 | } |
@@ -602,39 +593,6 @@ static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_f |
602 | 593 | return load_addr; |
603 | 594 | } |
604 | 595 |
|
605 | | -// Check for vDSO binary in kernel directory (/lib/modules/<version>/vdso), |
606 | | -// rewrite the given lib_name string if found. |
607 | | -// Otherwise copy vDSO memory in coredump to temporal memory generated by |
608 | | -// memfd_create(). |
609 | | -// Returns FD for vDSO (should be closed by caller), or -1 on error. |
610 | | -static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name_len) { |
611 | | - int lib_fd; |
612 | | - struct utsname uts; |
613 | | - uname(&uts); |
614 | | - |
615 | | - // Check vDSO binary first (for referring debuginfo if possible). |
616 | | - char *vdso_path = (char*)malloc(lib_name_len); |
617 | | - snprintf(vdso_path, lib_name_len, "/lib/modules/%s/vdso/vdso64.so", uts.release); |
618 | | - lib_fd = pathmap_open(vdso_path); |
619 | | - if (lib_fd != -1) { |
620 | | - print_debug("replace vDSO: %s -> %s\n", lib_name, vdso_path); |
621 | | - strncpy(lib_name, vdso_path, lib_name_len); |
622 | | - } else { |
623 | | - // Copy vDSO memory segment from core to temporal memory |
624 | | - // if vDSO binary is not available. |
625 | | - lib_fd = memfd_create("[vdso] in core", 0); |
626 | | - off64_t ofs = ph->core->vdso_offset; |
627 | | - if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { |
628 | | - print_debug("can't copy vDSO (%d)\n", errno); |
629 | | - close(lib_fd); |
630 | | - lib_fd = -1; |
631 | | - } |
632 | | - } |
633 | | - |
634 | | - free(vdso_path); |
635 | | - return lib_fd; |
636 | | -} |
637 | | - |
638 | 596 | // read shared library info from runtime linker's data structures. |
639 | 597 | // This work is done by librtlb_db in Solaris |
640 | 598 | static bool read_shared_lib_info(struct ps_prochandle* ph) { |
@@ -729,14 +687,9 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) { |
729 | 687 | // it will fail later. |
730 | 688 | } |
731 | 689 |
|
732 | | - if (lib_name[0] != '\0') { // ignore empty lib names |
733 | | - // We can use lib_base_diff to compare with vdso_addr |
734 | | - // because base address of vDSO should be 0. |
735 | | - if (lib_base_diff == ph->core->vdso_addr) { |
736 | | - lib_fd = handle_vdso(ph, lib_name, sizeof(lib_name)); |
737 | | - } else { |
738 | | - lib_fd = pathmap_open(lib_name); |
739 | | - } |
| 690 | + if (lib_name[0] != '\0') { |
| 691 | + // ignore empty lib names |
| 692 | + lib_fd = pathmap_open(lib_name); |
740 | 693 |
|
741 | 694 | if (lib_fd < 0) { |
742 | 695 | print_debug("can't open shared object %s\n", lib_name); |
|
0 commit comments