summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-12-15 18:28:03 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-06-25 00:43:01 +0200
commitcb34fffe07e13fc5ccbcc5e9fb7f951eb7d5c2b8 (patch)
tree584f2d700889e27b30429c26d5e5d37973849c8b
parentda5b48ef3c39ea68d41a43cfc4379124b67c0812 (diff)
downloadcygnal-cb34fffe07e13fc5ccbcc5e9fb7f951eb7d5c2b8.tar.gz
cygnal-cb34fffe07e13fc5ccbcc5e9fb7f951eb7d5c2b8.tar.bz2
cygnal-cb34fffe07e13fc5ccbcc5e9fb7f951eb7d5c2b8.zip
Remove CYGWIN=detect_bloda option
-rw-r--r--winsup/cygwin/cygtls.cc70
-rw-r--r--winsup/cygwin/environ.cc1
-rw-r--r--winsup/cygwin/globals.cc1
-rw-r--r--winsup/cygwin/net.cc12
-rw-r--r--winsup/doc/cygwinenv.xml15
-rw-r--r--winsup/doc/highlights.xml5
6 files changed, 7 insertions, 97 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index 6e9764d0f..1a2213d1f 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -27,70 +27,6 @@ _cygtls::call (DWORD (*func) (void *, void *), void *arg)
_my_tls.call2 (func, arg, buf);
}
-static int
-dll_cmp (const void *a, const void *b)
-{
- return wcscasecmp ((const wchar_t *) a, *(const wchar_t **) b);
-}
-
-/* Keep sorted!
- This is a list of well-known core system DLLs which contain code
- started in its own thread by the system. Kernel32.dll, for instance,
- contains the thread called on every Ctrl-C keypress in a console window.
- The DLLs in this list are not recognized as BLODAs. */
-const wchar_t *well_known_dlls[] =
-{
- L"advapi32.dll",
- L"kernel32.dll",
- L"kernelbase.dll",
- L"mswsock.dll",
- L"ntdll.dll",
- L"ole32.dll",
- L"shlwapi.dll",
- L"wbemprox.dll",
- L"ws2_32.dll",
-};
-
-/* Optional BLODA detection. The idea is that the function address is supposed
- to be within Cygwin itself. This is also true for pthreads, since pthreads
- are always calling pthread::thread_init_wrapper() in thread.cc. Therefore,
- every function call to a function outside of the Cygwin DLL is potentially
- a thread injected into the Cygwin process by some BLODA.
-
- But that's too simple. Assuming the application itself calls CreateThread,
- then this is a bad idea, but not really invalid. So we shouldn't print a
- BLODA message if the address is within the loaded image of the application.
- Also, ntdll.dll starts threads into the application which */
-static void
-bloda_detect (DWORD (*func) (void *, void *))
-{
- PIMAGE_DOS_HEADER img_start = (PIMAGE_DOS_HEADER)
- GetModuleHandle (NULL);
- PIMAGE_NT_HEADERS32 ntheader = (PIMAGE_NT_HEADERS32)
- ((PBYTE) img_start + img_start->e_lfanew);
- void *img_end = (void *) ((PBYTE) img_start
- + ntheader->OptionalHeader.SizeOfImage);
- if (((void *) func < (void *) cygwin_hmodule
- || (void *) func > (void *) cygheap)
- && ((void *) func < (void *) img_start || (void *) func >= img_end))
- {
- MEMORY_BASIC_INFORMATION mbi;
- wchar_t modname[PATH_MAX];
-
- VirtualQuery ((PVOID) func, &mbi, sizeof mbi);
- GetModuleFileNameW ((HMODULE) mbi.AllocationBase, modname,
- PATH_MAX);
- /* Fetch basename and check against list of above system DLLs. */
- const wchar_t *modbasename = wcsrchr (modname, L'\\') + 1;
- if (!bsearch (modbasename, well_known_dlls,
- sizeof well_known_dlls / sizeof well_known_dlls[0],
- sizeof well_known_dlls[0], dll_cmp))
- small_printf ("\n\nPotential BLODA detected! Thread function "
- "called outside of Cygwin DLL:\n %W\n\n",
- modname);
- }
-}
-
void
_cygtls::call2 (DWORD (*func) (void *, void *), void *arg, void *buf)
{
@@ -99,11 +35,7 @@ _cygtls::call2 (DWORD (*func) (void *, void *), void *arg, void *buf)
sense to call init_thread or perform BLODA detection. pthread_wrapper
eventually calls init_thread by itself. */
if ((void *) func != (void *) pthread_wrapper)
- {
- init_thread (buf, func);
- if (detect_bloda)
- bloda_detect (func);
- }
+ init_thread (buf, func);
DWORD res = func (arg, buf);
remove (INFINITE);
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 9248e8396..51107c561 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -110,7 +110,6 @@ static struct parse_thing
} values[2];
} known[] NO_COPY =
{
- {"detect_bloda", {&detect_bloda}, setbool, NULL, {{false}, {true}}},
{"dosfilewarning", {&dos_file_warning}, setbool, NULL, {{false}, {true}}},
{"error_start", {func: error_start_init}, isfunc, NULL, {{0}, {0}}},
{"export", {&export_settings}, setbool, NULL, {{false}, {true}}},
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 34305485e..5c5d64ee4 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -65,7 +65,6 @@ int NO_COPY dynamically_loaded;
/* Some CYGWIN environment variable variables. */
bool allow_glob = true;
-bool detect_bloda;
bool dos_file_warning;
bool ignore_case_with_glob;
bool pipe_byte;
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index bd3e0e342..52b3d9874 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -560,18 +560,6 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
debug_printf ("WSAIoctl: %u", WSAGetLastError ());
else if (base_soc != soc)
{
- /* LSPs are often BLODAs as well. So we print an info about
- detecting an LSP if BLODA detection is desired. */
- if (detect_bloda)
- {
- WSAPROTOCOL_INFO prot;
-
- memset (&prot, 0, sizeof prot);
- ::getsockopt (soc, SOL_SOCKET, SO_PROTOCOL_INFO, (char *) &prot,
- (size = sizeof prot, &size));
- small_printf ("\n\nPotential BLODA detected! Layered Socket "
- "Service Provider:\n %s\n\n", prot.szProtocol);
- }
if (GetHandleInformation ((HANDLE) base_soc, &flags)
&& (flags & HANDLE_FLAG_INHERIT))
{
diff --git a/winsup/doc/cygwinenv.xml b/winsup/doc/cygwinenv.xml
index ec9841472..6f67cb95d 100644
--- a/winsup/doc/cygwinenv.xml
+++ b/winsup/doc/cygwinenv.xml
@@ -16,16 +16,6 @@ by prefixing with <literal>no</literal>.</para>
<itemizedlist mark="bullet">
<listitem>
-<para><envar>(no)detect_bloda</envar> - If set, Cygwin will try to detect
-foreign applications which try to inject threads into a Cygwin process,
-or which redirect system sockets by providing an enforced so-called
-<literal>Layered Service Provider</literal>. This may or may not help to
-detect <ulink url="https://cygwin.com/faq/faq.html#faq.using.bloda">
-BLODAs</ulink>. Don't use this option for day-to-day usage, it will slow
-down every thread and socket creation!</para>
-</listitem>
-
-<listitem>
<para><envar>(no)dosfilewarning</envar> - If set, Cygwin will warn the
first time a user uses an "MS-DOS" style path name rather than a POSIX-style
path name. Defaults to off.</para>
@@ -131,6 +121,11 @@ explicitly in the open(2) call.
</listitem>
<listitem>
+<para><envar>(no)detect_bloda</envar> - No case of a BLODA found by this
+option has been reported in years.</para>
+</listitem>
+
+<listitem>
<para><envar>check_case</envar> - This option has been removed in favor of
real case sensitivity and the per-mount option "posix=[0|1]". For more
information, read the documentation in <xref linkend="mount-table"></xref> and
diff --git a/winsup/doc/highlights.xml b/winsup/doc/highlights.xml
index 05e682912..ec9fcd674 100644
--- a/winsup/doc/highlights.xml
+++ b/winsup/doc/highlights.xml
@@ -276,10 +276,7 @@ BLODA</ulink>. Badly-behaved applications which
inject dlls into other processes often manage to clobber important
sections of the child's address space, leading to base address
collisions which rebasing cannot fix. The only way to resolve this
-problem is to remove (usually uninstall) the offending app. See
-<xref linkend="cygwinenv-implemented-options"></xref> for the
-<literal>detect_bloda</literal> option, which may be able to identify the
-BLODA.</para></listitem>
+problem is to remove (usually uninstall) the offending app.</para></listitem>
</itemizedlist>