File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,13 @@ internal static class Opcode
1111
1212 public static bool Open ( )
1313 {
14- if ( SocketOptions . DoNotUseRDTSC )
14+ //Look for an environment variable: "NETQM_SUPPRESS_RDTSC" with a value of "TRUE"
15+ // The application can set this environment variable when this code is running in a system where
16+ // it is not desirable to read the processor's time stamp counter.
17+ // While this is supported in modern CPUs, the technique used for allocating executable memory, copying OP Code
18+ // for the read of the time stamp and invoking the OP Code can be detected as Malware by some anti-virus vendors.
19+ var val = Environment . GetEnvironmentVariable ( "NETQM_SUPPRESS_RDTSC" ) ;
20+ if ( "TRUE" . Equals ( val , StringComparison . OrdinalIgnoreCase ) )
1521 return false ;
1622#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
1723 if ( RuntimeInformation . ProcessArchitecture != Architecture . X86 &&
Original file line number Diff line number Diff line change @@ -12,16 +12,6 @@ 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 ;
2515 /// <summary>
2616 /// The NetMQSocket that this SocketOptions is referencing.
2717 /// </summary>
You can’t perform that action at this time.
0 commit comments