Skip to content

Commit 7d66cfc

Browse files
committed
changes to follow guidelines, removed node20 deprecation, fixed win32 warnings
1 parent 37a82ed commit 7d66cfc

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

.github/workflows/code_ql_analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555

5656
steps:
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5858

5959
- name: Setup Cpp
6060
uses: aminya/setup-cpp@v1

src/vmaware.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5477,15 +5477,15 @@ struct VM {
54775477
// std::random_device{}() uses RDRAND/RDSEED which can be intercepted by hypervisors
54785478
// we use our own compile-time seed that cannot be taken by examining PE/Linux binary properties and would need static/dynamic analysis
54795479
// this changes per build and per process session due to hardware ASLR
5480-
std::uintptr_t seed = 0;
5481-
seed ^= static_cast<std::uintptr_t>(ct_seed);
5482-
seed ^= reinterpret_cast<std::uintptr_t>(&current_process);
5483-
seed ^= reinterpret_cast<std::uintptr_t>(&procMask) << 1;
5484-
seed ^= reinterpret_cast<std::uintptr_t>(&sysMask) << 2;
5485-
seed ^= reinterpret_cast<std::uintptr_t>(&len) << 3;
5486-
seed ^= reinterpret_cast<std::uintptr_t>(&stackBuf[0]) << 4;
5487-
seed ^= reinterpret_cast<std::uintptr_t>(&heapBuf) << 5;
5488-
seed ^= reinterpret_cast<std::uintptr_t>(&buf) << 6;
5480+
std::uint64_t seed = 0;
5481+
seed ^= static_cast<u64>(ct_seed);
5482+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&current_process));
5483+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&procMask)) << 1;
5484+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&sysMask)) << 2;
5485+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&len)) << 3;
5486+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&stackBuf[0])) << 4;
5487+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&heapBuf)) << 5;
5488+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&buf)) << 6;
54895489

54905490
seed ^= seed >> 33;
54915491
seed *= 0xff51afd7ed558ccdULL;
@@ -5711,17 +5711,17 @@ struct VM {
57115711

57125712
// so that hypervisor can't predict how many samples we will collect
57135713
// stack-only / ASLR-derived component (no APIs, no rdtsc)
5714-
std::uintptr_t seed = 0;
5715-
seed ^= static_cast<std::uintptr_t>(ct_seed);
5714+
std::uint64_t seed = 0;
5715+
seed ^= static_cast<std::uint64_t>(ct_seed);
57165716

57175717
std::uint64_t local1 = 0;
57185718
std::uint64_t local2 = 0;
57195719
std::uint64_t local3 = 0;
57205720

5721-
seed ^= reinterpret_cast<std::uintptr_t>(&seed);
5722-
seed ^= reinterpret_cast<std::uintptr_t>(&local1) << 1;
5723-
seed ^= reinterpret_cast<std::uintptr_t>(&local2) << 2;
5724-
seed ^= reinterpret_cast<std::uintptr_t>(&local3) << 3;
5721+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&seed));
5722+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&local1)) << 1;
5723+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&local2)) << 2;
5724+
seed ^= static_cast<u64>(reinterpret_cast<std::uintptr_t>(&local3)) << 3;
57255725

57265726
// splitmix64
57275727
seed ^= seed >> 33;

0 commit comments

Comments
 (0)