}
// This stress mode name did not match anything in the stress
- // mode whitelist. If user has requested only enable mode,
+ // mode allowlist. If user has requested only enable mode,
// don't allow this stress mode to turn on.
const bool onlyEnableMode = JitConfig.JitStressModeNamesOnly() != 0;
// To help in the incremental conversion of jit activity to phases
// without greatly increasing dump size or checked jit time, we
- // currently whitelist the phases that do pre-phase checks and
+ // currently allow the phases that do pre-phase checks and
// dumps via the phase object, and not via explicit calls from
// the various methods in the phase.
//
//
// Currently the list is just the set of phases that have custom
// derivations from the Phase class.
- static Phases s_whitelist[] = {PHASE_BUILD_SSA, PHASE_RATIONALIZE, PHASE_LOWERING, PHASE_STACK_LEVEL_SETTER};
+ static Phases s_allowlist[] = {PHASE_BUILD_SSA, PHASE_RATIONALIZE, PHASE_LOWERING, PHASE_STACK_LEVEL_SETTER};
bool doPrePhase = false;
- for (size_t i = 0; i < sizeof(s_whitelist) / sizeof(Phases); i++)
+ for (size_t i = 0; i < sizeof(s_allowlist) / sizeof(Phases); i++)
{
- if (m_phase == s_whitelist[i])
+ if (m_phase == s_allowlist[i])
{
doPrePhase = true;
break;
// To help in the incremental conversion of jit activity to phases
// without greatly increasing dump size or checked jit time, we
- // currently whitelist the phases that do post-phase checks and
+ // currently allow the phases that do post-phase checks and
// dumps via the phase object, and not via explicit calls from
// the various methods in the phase.
//
// well as the new-style phases that have been updated to return
// PhaseStatus from their DoPhase methods.
//
- static Phases s_whitelist[] = {PHASE_IMPORTATION,
+ static Phases s_allowlist[] = {PHASE_IMPORTATION,
PHASE_INDXCALL,
PHASE_MORPH_INLINE,
PHASE_ALLOCATE_OBJECTS,
if (madeChanges)
{
- for (size_t i = 0; i < sizeof(s_whitelist) / sizeof(Phases); i++)
+ for (size_t i = 0; i < sizeof(s_allowlist) / sizeof(Phases); i++)
{
- if (m_phase == s_whitelist[i])
+ if (m_phase == s_allowlist[i])
{
doPostPhase = true;
break;
throw new ArgumentException($"Error: InputDirectory must point at a SERP build. Could not find {Path.Combine(SerpDir, "runserp.cmd")}");
}
- string whiteListFilePath = Path.Combine(SerpDir, "WhitelistDlls.txt");
- if (!File.Exists(whiteListFilePath))
+ string allowListFilePath = Path.Combine(SerpDir, "WhitelistDlls.txt");
+ if (!File.Exists(allowListFilePath))
{
- throw new ArgumentException($"File {whiteListFilePath} was not found");
+ throw new ArgumentException($"File {allowListFilePath} was not found");
}
// Add all assemblies from the various SERP packages (filtered by ShouldInclude)
_coreCompileAssemblies = new List<string>();
_coreReferenceAssemblies = new List<string>();
{
- // Add a whitelist of assemblies from bin
- foreach (string item in new HashSet<string>(File.ReadAllLines(whiteListFilePath)))
+ // Add an allowlist of assemblies from bin
+ foreach (string item in new HashSet<string>(File.ReadAllLines(allowListFilePath)))
{
string binAssembly = Path.Combine(BinDir, item);
_coreCompileAssemblies.Add(binAssembly);
private bool _persistAuthority;
/// <summary>
- /// When an Alt-Svc authority fails due to 421 Misdirected Request, it is placed in the blacklist to be ignored
- /// for <see cref="AltSvcBlacklistTimeoutInMilliseconds"/> milliseconds. Initialized on first use.
+ /// When an Alt-Svc authority fails due to 421 Misdirected Request, it is placed in the blocklist to be ignored
+ /// for <see cref="AltSvcBlocklistTimeoutInMilliseconds"/> milliseconds. Initialized on first use.
/// </summary>
- private volatile HashSet<HttpAuthority>? _altSvcBlacklist;
- private CancellationTokenSource? _altSvcBlacklistTimerCancellation;
+ private volatile HashSet<HttpAuthority>? _altSvcBlocklist;
+ private CancellationTokenSource? _altSvcBlocklistTimerCancellation;
private volatile bool _altSvcEnabled = true;
/// <summary>
- /// If <see cref="_altSvcBlacklist"/> exceeds this size, Alt-Svc will be disabled entirely for <see cref="AltSvcBlacklistTimeoutInMilliseconds"/> milliseconds.
+ /// If <see cref="_altSvcBlocklist"/> exceeds this size, Alt-Svc will be disabled entirely for <see cref="AltSvcBlocklistTimeoutInMilliseconds"/> milliseconds.
/// This is to prevent a failing server from bloating the dictionary beyond a reasonable value.
/// </summary>
private const int MaxAltSvcIgnoreListSize = 8;
- /// <summary>The time, in milliseconds, that an authority should remain in <see cref="_altSvcBlacklist"/>.</summary>
- private const int AltSvcBlacklistTimeoutInMilliseconds = 10 * 60 * 1000;
+ /// <summary>The time, in milliseconds, that an authority should remain in <see cref="_altSvcBlocklist"/>.</summary>
+ private const int AltSvcBlocklistTimeoutInMilliseconds = 10 * 60 * 1000;
/// <summary>List of idle connections stored in the pool.</summary>
private readonly List<CachedConnection> _idleConnections = new List<CachedConnection>();
#if false
if (quicConnection.NegotiatedApplicationProtocol != SslApplicationProtocol.Http3)
{
- BlacklistAuthority(authority);
+ BlocklistAuthority(authority);
throw new HttpRequestException("QUIC connected but no HTTP/3 indicated via ALPN.", null, RequestRetryType.RetryOnSameOrNextProxy);
}
#endif
// If an Alt-Svc authority returns 421, it means it can't actually handle the request.
// An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug.
- // In this case, we blacklist the authority and retry the request at the origin.
+ // In this case, we blocklist the authority and retry the request at the origin.
if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection is Http3Connection h3Connection && h3Connection.Authority != _originAuthority)
{
response.Dispose();
- BlacklistAuthority(h3Connection.Authority);
+ BlocklistAuthority(h3Connection.Authority);
continue;
}
{
var authority = new HttpAuthority(value.Host!, value.Port);
- if (_altSvcBlacklist != null)
+ if (_altSvcBlocklist != null)
{
- lock (_altSvcBlacklist)
+ lock (_altSvcBlocklist)
{
- if (_altSvcBlacklist.Contains(authority))
+ if (_altSvcBlocklist.Contains(authority))
{
- // Skip authorities in our blacklist.
+ // Skip authorities in our blocklist.
continue;
}
}
}
/// <summary>
- /// Blacklists an authority and resets the current authority back to origin.
- /// If the number of blacklisted authorities exceeds <see cref="MaxAltSvcIgnoreListSize"/>,
+ /// Blocklists an authority and resets the current authority back to origin.
+ /// If the number of blocklisted authorities exceeds <see cref="MaxAltSvcIgnoreListSize"/>,
/// Alt-Svc will be disabled entirely for a period of time.
/// </summary>
/// <remarks>
/// This is called when we get a "421 Misdirected Request" from an alternate authority.
/// A future strategy would be to retry the individual request on an older protocol, we'd want to have
- /// some logic to blacklist after some number of failures to avoid doubling our request latency.
+ /// some logic to blocklist after some number of failures to avoid doubling our request latency.
///
/// For now, the spec states alternate authorities should be able to handle ALL requests, so this
- /// is treated as an exceptional error by immediately blacklisting the authority.
+ /// is treated as an exceptional error by immediately blocklisting the authority.
/// </remarks>
- internal void BlacklistAuthority(HttpAuthority badAuthority)
+ internal void BlocklistAuthority(HttpAuthority badAuthority)
{
Debug.Assert(badAuthority != null);
Debug.Assert(badAuthority != _originAuthority);
- HashSet<HttpAuthority>? altSvcBlacklist = _altSvcBlacklist;
+ HashSet<HttpAuthority>? altSvcBlocklist = _altSvcBlocklist;
- if (altSvcBlacklist == null)
+ if (altSvcBlocklist == null)
{
lock (SyncObj)
{
- altSvcBlacklist = _altSvcBlacklist;
- if (altSvcBlacklist == null)
+ altSvcBlocklist = _altSvcBlocklist;
+ if (altSvcBlocklist == null)
{
- altSvcBlacklist = new HashSet<HttpAuthority>();
- _altSvcBlacklistTimerCancellation = new CancellationTokenSource();
- _altSvcBlacklist = altSvcBlacklist;
+ altSvcBlocklist = new HashSet<HttpAuthority>();
+ _altSvcBlocklistTimerCancellation = new CancellationTokenSource();
+ _altSvcBlocklist = altSvcBlocklist;
}
}
}
bool added, disabled = false;
- lock (altSvcBlacklist)
+ lock (altSvcBlocklist)
{
- added = altSvcBlacklist.Add(badAuthority);
+ added = altSvcBlocklist.Add(badAuthority);
- if (added && altSvcBlacklist.Count >= MaxAltSvcIgnoreListSize && _altSvcEnabled)
+ if (added && altSvcBlocklist.Count >= MaxAltSvcIgnoreListSize && _altSvcEnabled)
{
_altSvcEnabled = false;
disabled = true;
}
}
- Debug.Assert(_altSvcBlacklistTimerCancellation != null);
+ Debug.Assert(_altSvcBlocklistTimerCancellation != null);
if (added)
{
- _ = Task.Delay(AltSvcBlacklistTimeoutInMilliseconds)
+ _ = Task.Delay(AltSvcBlocklistTimeoutInMilliseconds)
.ContinueWith(t =>
{
- lock (altSvcBlacklist)
+ lock (altSvcBlocklist)
{
- altSvcBlacklist.Remove(badAuthority);
+ altSvcBlocklist.Remove(badAuthority);
}
- }, _altSvcBlacklistTimerCancellation.Token, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
+ }, _altSvcBlocklistTimerCancellation.Token, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
}
if (disabled)
{
- _ = Task.Delay(AltSvcBlacklistTimeoutInMilliseconds)
+ _ = Task.Delay(AltSvcBlocklistTimeoutInMilliseconds)
.ContinueWith(t =>
{
_altSvcEnabled = true;
- }, _altSvcBlacklistTimerCancellation.Token, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
+ }, _altSvcBlocklistTimerCancellation.Token, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
}
}
_authorityExpireTimer = null;
}
- if (_altSvcBlacklistTimerCancellation != null)
+ if (_altSvcBlocklistTimerCancellation != null)
{
- _altSvcBlacklistTimerCancellation.Cancel();
- _altSvcBlacklistTimerCancellation.Dispose();
- _altSvcBlacklistTimerCancellation = null;
+ _altSvcBlocklistTimerCancellation.Cancel();
+ _altSvcBlocklistTimerCancellation.Dispose();
+ _altSvcBlocklistTimerCancellation = null;
}
}
Debug.Assert(list.Count == 0, $"Expected {nameof(list)}.{nameof(list.Count)} == 0");
// resource files containing thousands of resources.
//
#if CORERT
- public // On CoreRT, this must be public because of need to whitelist past the ReflectionBlock.
+ public // On CoreRT, this must be public to prevent it from getting reflection blocked.
#else
internal
#endif
static MonoCoopMutex native_library_module_lock;
static GHashTable *native_library_module_map;
/*
- * This blacklist is used as a set for cache invalidation purposes with netcore pinvokes.
+ * This blocklist is used as a set for cache invalidation purposes with netcore pinvokes.
* When pinvokes are resolved with anything other than the last-chance managed event,
* the results of that lookup are added to an ALC-level cache. However, if a library is then
* unloaded with NativeLibrary.Free(), this cache should be invalidated so that a newly called
- * pinvoke will not attempt to use it, hence the blacklist. This design means that if another
+ * pinvoke will not attempt to use it, hence the blocklist. This design means that if another
* library is loaded at the same address, it will function with a perf hit, as the entry will
- * repeatedly be added and removed from the cache due to its presence in the blacklist.
+ * repeatedly be added and removed from the cache due to its presence in the blocklist.
* This is a rare scenario and considered a worthwhile tradeoff.
*/
-static GHashTable *native_library_module_blacklist;
+static GHashTable *native_library_module_blocklist;
#endif
#ifndef DISABLE_DLLMAP
#ifdef ENABLE_NETCORE
if (!native_library_module_map)
native_library_module_map = g_hash_table_new (g_direct_hash, g_direct_equal);
- if (!native_library_module_blacklist)
- native_library_module_blacklist = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if (!native_library_module_blocklist)
+ native_library_module_blocklist = g_hash_table_new (g_direct_hash, g_direct_equal);
mono_coop_mutex_init (&native_library_module_lock);
#endif
}
// LOCKING: expects you to hold native_library_module_lock
static gboolean
-netcore_check_blacklist (MonoDl *module)
+netcore_check_blocklist (MonoDl *module)
{
- return g_hash_table_contains (native_library_module_blacklist, module);
+ return g_hash_table_contains (native_library_module_blocklist, module);
}
static MonoDl *
result = (MonoDl *)g_hash_table_lookup (alc->pinvoke_scopes, scope);
if (result) {
- gboolean blacklisted;
+ gboolean blocklisted;
native_library_lock ();
- blacklisted = netcore_check_blacklist (result);
+ blocklisted = netcore_check_blocklist (result);
native_library_unlock ();
- if (blacklisted) {
+ if (blocklisted) {
g_hash_table_remove (alc->pinvoke_scopes, scope);
result = NULL;
}
goto leave;
g_hash_table_remove (native_library_module_map, module->handle);
- g_hash_table_add (native_library_module_blacklist, module);
+ g_hash_table_add (native_library_module_blocklist, module);
mono_dl_close (module);
leave:
/* emit call to managed conversion method */
return FALSE;
} else if (!strcmp (".cctor", tm)) {
- /* white list */
return FALSE;
} else if (!strcmp ("Parse", tm)) {
- /* white list */
return FALSE;
} else if (!strcmp ("ToString", tm)) {
- /* white list */
return FALSE;
} else if (!strcmp ("GetHashCode", tm)) {
- /* white list */
return FALSE;
} else if (!strcmp ("IsNaN", tm) || !strcmp ("IsInfinity", tm) || !strcmp ("IsNegativeInfinity", tm) || !strcmp ("IsPositiveInfinity", tm)) {
g_assert (type_index == 2); // nfloat only
- /* white list */
return FALSE;
}
typedef struct {
char *suffix;
char *exported_name;
-} MonoLibWhitelistEntry;
+} MonoLibAllowlistEntry;
-static GList *native_library_whitelist;
+static GList *native_library_allowlist;
static gboolean allow_all_native_libraries = FALSE;
static void
// Examples: libsystem_pthread.dylib -> "pthread"
// Examples: libsystem_platform.dylib -> "platform"
// Examples: mono-sgen -> "mono" from above line
- MonoLibWhitelistEntry *entry = g_new0 (MonoLibWhitelistEntry, 1);
+ MonoLibAllowlistEntry*entry = g_new0 (MonoLibAllowlistEntry, 1);
entry->suffix = g_strdup (module_path);
entry->exported_name = g_strdup (module_name);
- native_library_whitelist = g_list_append (native_library_whitelist, entry);
+ native_library_allowlist = g_list_append (native_library_allowlist, entry);
}
static void
}
static gboolean
-check_whitelisted_module (const char *in_name, const char **out_module)
+check_allowlisted_module (const char *in_name, const char **out_module)
{
#ifndef MONO_PRIVATE_CRASHES
return TRUE;
return TRUE;
}
- for (GList *cursor = native_library_whitelist; cursor; cursor = cursor->next) {
- MonoLibWhitelistEntry *iter = (MonoLibWhitelistEntry *) cursor->data;
+ for (GList *cursor = native_library_allowlist; cursor; cursor = cursor->next) {
+ MonoLibAllowlistEntry*iter = (MonoLibAllowlistEntry*) cursor->data;
if (!g_str_has_suffix (in_name, iter->suffix))
continue;
if (out_module)
if (!success)
return FALSE;
- if (!check_whitelisted_module (fname, out_module))
+ if (!check_allowlisted_module (fname, out_module))
return FALSE;
*out_ip = mono_make_portable_ip ((intptr_t) saddr, (intptr_t) fbase);
gboolean mono_use_fast_math = FALSE;
-// Lists of whitelisted and blacklisted CPU features
+// Lists of allowlisted and blocklisted CPU features
MonoCPUFeatures mono_cpu_features_enabled = (MonoCPUFeatures)0;
#ifdef DISABLE_SIMD
happened. This might make for a good first implementation to get
some data on performance.
- *) Some sort of blacklist support? Blacklists is a concept from the
+ *) Some sort of blocklist support? Blocklists is a concept from the
Boehm GC: if during a conservative scan we find pointers to an
area which we might use as heap, we mark that area as unusable, so
pointer retention by random pinning pointers is reduced.