Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
bebb4670
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bebb4670
编写于
2月 07, 2018
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
598ec484
836bf4f5
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
103 addition
and
6 deletion
+103
-6
.hgtags
.hgtags
+2
-0
agent/src/os/linux/Makefile
agent/src/os/linux/Makefile
+4
-1
make/linux/makefiles/gcc.make
make/linux/makefiles/gcc.make
+3
-1
make/linux/makefiles/jsig.make
make/linux/makefiles/jsig.make
+2
-2
src/share/vm/prims/whitebox.cpp
src/share/vm/prims/whitebox.cpp
+21
-1
test/runtime/execstack/TestCheckJDK.java
test/runtime/execstack/TestCheckJDK.java
+67
-0
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+4
-1
未找到文件。
.hgtags
浏览文件 @
bebb4670
...
...
@@ -1132,6 +1132,8 @@ c3618e1cdefdda6c262f082791bfd988e0e9d9c9 jdk8u162-b10
69aec2ca5d905dde1d0f29a89076d02a531808a3 jdk8u162-b12
caac74fe3cfa9a8c859c28c97d1046a58252af27 jdk8u162-b31
c9b7abadf150328d2187de05b9e8a9cba2486e47 jdk8u162-b32
e8041f2ec96eb6a41307732e6cf6ed90901438ae jdk8u162-b33
bf2e8b1e8e8e6bc1f9b9475de54ba0329a6b24b1 jdk8u162-b34
a17bab9405474602b18cd62e060a09b17d6413ac jdk8u171-b00
ebfd57cc21e6b7f0c22b17c666b6b28c9340e207 jdk8u171-b01
1acd7c1b80241def8fac90f70b0df16356adad47 jdk8u171-b02
...
...
agent/src/os/linux/Makefile
浏览文件 @
bebb4670
#
# Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 201
8
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -76,6 +76,9 @@ ifneq ($(_HAS_HASH_STYLE_GNU),)
endif
LFLAGS_LIBSA
+=
$(LDFLAGS_HASH_STYLE)
LDFLAGS_NO_EXEC_STACK
=
"-Wl,-z,noexecstack"
LFLAGS_LIBSA
+=
$(LDFLAGS_NO_EXEC_STACK)
$(LIBSA)
:
$(ARCH) $(OBJS) mapfile
$(GCC)
-shared
$(LFLAGS_LIBSA)
-o
$(LIBSA)
$(OBJS)
$(LIBS)
...
...
make/linux/makefiles/gcc.make
浏览文件 @
bebb4670
#
# Copyright (c) 1999, 201
5
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 201
8
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -303,6 +303,8 @@ endif
LFLAGS
+=
$(LDFLAGS_HASH_STYLE)
LDFLAGS_NO_EXEC_STACK
=
"-Wl,-z,noexecstack"
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
MAPFLAG
=
-Xlinker
--version-script
=
FILENAME
...
...
make/linux/makefiles/jsig.make
浏览文件 @
bebb4670
#
# Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 201
8
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -44,7 +44,7 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig
# cause problems with interposing. See CR: 6466665
# LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE))
LFLAGS_JSIG
+=
-D_GNU_SOURCE
-D_REENTRANT
$(LDFLAGS_HASH_STYLE)
LFLAGS_JSIG
+=
-D_GNU_SOURCE
-D_REENTRANT
$(LDFLAGS_HASH_STYLE)
$(LDFLAGS_NO_EXEC_STACK)
# DEBUG_BINARIES overrides everything, use full -g debug information
ifeq
($(DEBUG_BINARIES), true)
...
...
src/share/vm/prims/whitebox.cpp
浏览文件 @
bebb4670
/*
* Copyright (c) 2012, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
8
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -158,6 +158,9 @@ WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring s
}
WB_END
#ifdef LINUX
#include "utilities/elfFile.hpp"
#endif
WB_ENTRY
(
jlong
,
WB_GetCompressedOopsMaxHeapSize
(
JNIEnv
*
env
,
jobject
o
))
{
return
(
jlong
)
Arguments
::
max_heap_for_compressed_oops
();
...
...
@@ -1010,6 +1013,21 @@ void WhiteBox::register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
}
}
// Checks that the library libfile has the noexecstack bit set.
WB_ENTRY
(
jboolean
,
WB_CheckLibSpecifiesNoexecstack
(
JNIEnv
*
env
,
jobject
o
,
jstring
libfile
))
jboolean
ret
=
false
;
#ifdef LINUX
// Can't be in VM when we call JNI.
ThreadToNativeFromVM
ttnfv
(
thread
);
const
char
*
lf
=
env
->
GetStringUTFChars
(
libfile
,
NULL
);
CHECK_JNI_EXCEPTION_
(
env
,
0
);
ElfFile
ef
(
lf
);
ret
=
(
jboolean
)
ef
.
specifies_noexecstack
();
env
->
ReleaseStringUTFChars
(
libfile
,
lf
);
#endif
return
ret
;
WB_END
#define CC (char*)
static
JNINativeMethod
methods
[]
=
{
...
...
@@ -1121,6 +1139,8 @@ static JNINativeMethod methods[] = {
(
void
*
)
&
WB_GetNMethod
},
{
CC
"isMonitorInflated"
,
CC
"(Ljava/lang/Object;)Z"
,
(
void
*
)
&
WB_IsMonitorInflated
},
{
CC
"forceSafepoint"
,
CC
"()V"
,
(
void
*
)
&
WB_ForceSafepoint
},
{
CC
"checkLibSpecifiesNoexecstack"
,
CC
"(Ljava/lang/String;)Z"
,
(
void
*
)
&
WB_CheckLibSpecifiesNoexecstack
},
};
#undef CC
...
...
test/runtime/execstack/TestCheckJDK.java
0 → 100644
浏览文件 @
bebb4670
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test Testexecstack.java
* @summary Searches for all libraries in test VM and checks that they
* have the noexecstack bit set.
* @requires (os.family == "linux")
* @library /testlibrary /testlibrary/whitebox
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* TestCheckJDK
*/
import
com.oracle.java.testlibrary.Asserts
;
import
sun.hotspot.WhiteBox
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
public
class
TestCheckJDK
{
static
boolean
testPassed
=
true
;
private
static
final
WhiteBox
WB
=
WhiteBox
.
getWhiteBox
();
static
void
checkExecStack
(
Path
file
)
{
String
filename
=
file
.
toString
();
if
(
filename
.
endsWith
(
".so"
))
{
if
(!
WB
.
checkLibSpecifiesNoexecstack
(
filename
))
{
System
.
out
.
println
(
"Library does not have the noexecstack bit set: "
+
filename
);
testPassed
=
false
;
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
String
vmInstallDir
=
System
.
getProperty
(
"java.home"
);
Files
.
walk
(
Paths
.
get
(
vmInstallDir
)).
filter
(
Files:
:
isRegularFile
).
forEach
(
TestCheckJDK:
:
checkExecStack
);
Asserts
.
assertTrue
(
testPassed
,
"The tested VM contains libs that don't have the noexecstack "
+
"bit set. They must be linked with -z,noexecstack."
);
}
}
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
浏览文件 @
bebb4670
/*
* Copyright (c) 2012, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
8
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -235,4 +235,7 @@ public class WhiteBox {
// Class Data Sharing
public
native
boolean
isSharedClass
(
Class
<?>
c
);
// Returns true on linux if library has the noexecstack flag set.
public
native
boolean
checkLibSpecifiesNoexecstack
(
String
libfilename
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录