对rt.jar中的java.lang.String进行简单修改,导致VM段错误

 杜庆坤66 发布于 2023-01-16 17:19

重现步骤:

    从JDK的src.zip中对java.lang.String进行一些简单的修改,例如添加

    private boolean dummy = false;

    编译更改(Eclipse编译器)

    使用新的java/lang/String.class更新rt.jar

    用更新的版本替换jre/lib中的rt.jar.

    运行bin/java或任何使用rt.jar的工具

每次启动时,VM都会出现段错误.

操作系统是Linux(Debian Wheezy)x86_64.同时发生JDK 1.7.0_55和1.8.0_05

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000000000000, pid=13313, tid=140065468557056
#
# JRE version:  (7.0_55-b13) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000000000
#
# Core dump written. Default location: /home/chris/workspace/JDK7/foo/core or core.13313
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x0000000000eb6000):  JavaThread "Unknown thread" [_thread_in_Java, id=13314, stack(0x00007f63886fa000,0x00007f63887fb000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000000

在gdb中加载核心转储给出:

chris@nb:~/workspace/JDK7/foo$ gdb /home/chris/java/bin/java core
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/chris/jdk1.7.0_55/bin/java...(no debugging symbols     found)...done.

warning: core file may not match specified executable file.
[New LWP 13314]
[New LWP 13315]
[New LWP 13313]
[New LWP 13316]
[New LWP 13317]

warning: Error reading shared library list entry at 0x302e6f732e646165

warning: Error reading shared library list entry at 0x5f006f732e696c6a
Core was generated by `jar cf rt.jar com java javax META-INF org sun sunw'.
Program terminated with signal 6, Aborted.
#0  0x00007f6387c6b475 in ?? ()
(gdb) bt
#0  0x00007f6387c6b475 in ?? ()
#1  0x00007f6387c6e6f0 in ?? ()
#2  0x0000000000000000 in ?? ()

我以前用这种方式修改了其他VM类(早期的Java 7版本)没有问题.java.lang.String有什么特别之处,这意味着它无法修改吗?(校验和等?)

这是针对个人基准测试实验,因此无需回复许可/分发问题.

谢谢,

克里斯

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有