Skip to content

Commit 9f13ec1

Browse files
committed
8377365: [BACKOUT] Mixed jstack cannot find function in vDSO
Reviewed-by: thartmann
1 parent 77e8469 commit 9f13ec1

File tree

5 files changed

+8
-225
lines changed

5 files changed

+8
-225
lines changed

src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -95,9 +95,6 @@ struct core_data {
9595
// part of the class sharing workaround
9696
int classes_jsa_fd; // file descriptor of class share archive
9797
uintptr_t dynamic_addr; // address of dynamic section of a.out
98-
uintptr_t vdso_addr; // address of vDSO
99-
off64_t vdso_offset; // offset of vDSO in core
100-
size_t vdso_size; // size of vDSO
10198
uintptr_t ld_base_addr; // base address of ld.so
10299
size_t num_maps; // number of maps.
103100
map_info* maps; // maps in a linked list

src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,6 @@
3131
#include <elf.h>
3232
#include <link.h>
3333
#include <errno.h>
34-
#include <sys/mman.h>
35-
#include <sys/sendfile.h>
36-
#include <sys/utsname.h>
3734
#include "libproc_impl.h"
3835
#include "ps_core_common.h"
3936
#include "proc_service.h"
@@ -288,8 +285,6 @@ static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) {
288285
// We will adjust it in read_exec_segments().
289286
ph->core->dynamic_addr = auxv->a_un.a_val;
290287
break;
291-
} else if (auxv->a_type == AT_SYSINFO_EHDR) {
292-
ph->core->vdso_addr = auxv->a_un.a_val;
293288
}
294289
auxv++;
295290
}
@@ -355,10 +350,6 @@ static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) {
355350
print_error("failed to add map info\n");
356351
goto err;
357352
}
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-
}
362353
}
363354
break;
364355
}
@@ -602,39 +593,6 @@ static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_f
602593
return load_addr;
603594
}
604595

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-
638596
// read shared library info from runtime linker's data structures.
639597
// This work is done by librtlb_db in Solaris
640598
static bool read_shared_lib_info(struct ps_prochandle* ph) {
@@ -729,14 +687,9 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) {
729687
// it will fail later.
730688
}
731689

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);
740693

741694
if (lib_fd < 0) {
742695
print_debug("can't open shared object %s\n", lib_name);

test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java

Lines changed: 0 additions & 96 deletions
This file was deleted.

test/lib/jdk/test/lib/apps/LingeredApp.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -122,12 +122,6 @@ public void setForceCrash(boolean forceCrash) {
122122
this.forceCrash = forceCrash;
123123
}
124124

125-
private static Runnable crasher;
126-
127-
public static void setCrasher(Runnable runnable) {
128-
crasher = runnable;
129-
}
130-
131125
native private static int crash();
132126

133127
/**
@@ -634,12 +628,8 @@ public static void main(String args[]) {
634628
synchronized(steadyStateObj) {
635629
startSteadyStateThread(steadyStateObj);
636630
if (forceCrash) {
637-
if (crasher == null) {
638-
System.loadLibrary("LingeredApp"); // location of native crash() method
639-
crash();
640-
} else {
641-
crasher.run();
642-
}
631+
System.loadLibrary("LingeredApp"); // location of native crash() method
632+
crash();
643633
}
644634
while (Files.exists(path)) {
645635
// Touch the lock to indicate our readiness

0 commit comments

Comments
 (0)