Remove CYGWIN=detect_bloda option
This commit is contained in:
parent
da5b48ef3c
commit
cb34fffe07
@ -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);
|
||||
|
@ -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}}},
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -15,16 +15,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
|
||||
@ -130,6 +120,11 @@ explicitly in the open(2) call.
|
||||
</para>
|
||||
</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
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user