Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit e85892b

Browse files
author
Jaroslav Bachorik
committedJan 15, 2021
8258396: SIGILL in jdk.jfr.internal.PlatformRecorder.rotateDisk()
Reviewed-by: egahlin Backport-of: a06cea5
1 parent 4307fa6 commit e85892b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ BufferPtr JfrStorage::flush(BufferPtr cur, size_t used, size_t req, bool native,
405405

406406
BufferPtr JfrStorage::flush_regular(BufferPtr cur, const u1* const cur_pos, size_t used, size_t req, bool native, Thread* t) {
407407
debug_only(assert_flush_regular_precondition(cur, cur_pos, used, req, t);)
408-
// A flush is needed before memcpy since a non-large buffer is thread stable
408+
// A flush is needed before memmove since a non-large buffer is thread stable
409409
// (thread local). The flush will not modify memory in addresses above pos()
410410
// which is where the "used / uncommitted" data resides. It is therefore both
411411
// possible and valid to migrate data after the flush. This is however only
@@ -417,7 +417,8 @@ BufferPtr JfrStorage::flush_regular(BufferPtr cur, const u1* const cur_pos, size
417417
if (cur->free_size() >= req) {
418418
// simplest case, no switching of buffers
419419
if (used > 0) {
420-
memcpy(cur->pos(), (void*)cur_pos, used);
420+
// source and destination may overlap so memmove must be used instead of memcpy
421+
memmove(cur->pos(), (void*)cur_pos, used);
421422
}
422423
assert(native ? t->jfr_thread_local()->native_buffer() == cur : t->jfr_thread_local()->java_buffer() == cur, "invariant");
423424
return cur;

0 commit comments

Comments
 (0)
This repository has been archived.