File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ internal static class Opcode
1111
1212 public static bool Open ( )
1313 {
14+ if ( SocketOptions . DoNotUseRDTSC )
15+ return false ;
1416#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
1517 if ( RuntimeInformation . ProcessArchitecture != Architecture . X86 &&
1618 RuntimeInformation . ProcessArchitecture != Architecture . X64 )
Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ namespace NetMQ
1212 /// </summary>
1313 public class SocketOptions
1414 {
15+ /// <summary>
16+ /// If set, the time stamp counter is not read directly through opcode injection,
17+ /// rather <see cref="System.Diagnostics.Stopwatch.GetTimestamp"/> is used.
18+ /// When false, the time stamp counter is read by allocating a few bytes on the heap with
19+ /// read/write/execute privilege. OpCode is copied to this allocated memory and invoked to read
20+ /// the time stamp counter, (which is a register available on most modern CPUs). While this is
21+ /// an accurate way to read the time stamp counter, because it injects code onto the heap, this
22+ /// can be detected as a malware technique by some anti-virus defenders.
23+ /// </summary>
24+ public static bool DoNotUseRDTSC ;
1525 /// <summary>
1626 /// The NetMQSocket that this SocketOptions is referencing.
1727 /// </summary>
You can’t perform that action at this time.
0 commit comments