{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752666884,
"reponame":"openssl",
"desc":"OpenSSL",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"b9b23e9b48ce379ca92f0f3a14f99b17",
"commit": {"type":"commit",
"time": 1550865887,
"time_ofs": 60,
"oid_tree": { "oid": "26214e0b669bdb19525e10375edeef1d0361fc74", "alias": []},
"oid":{ "oid": "4af54c9b9933336d1c48f3012aca92262c36d3a8", "alias": []},
"msg": "Windows: Call TerminateProcess, not ExitProcess",
"sig_commit": { "git_time": { "time": 1550865887, "offset": 60 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" },
"sig_author": { "git_time": { "time": 1550769950, "offset": 60 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" }},
"body": "Windows: Call TerminateProcess, not ExitProcess\n\nTy Baen-Price explains:\n\n\u003e Problem and Resolution:\n\u003e The following lines of code make use of the Microsoft API ExitProcess:\n\u003e\n\u003e ```\n\u003e Apps\u005cSpeed.c line 335:\tExitProcess(ret);\n\u003e Ms\u005cuplink.c line 22: ExitProcess(1);\n\u003e ```\n\u003e\n\u003e These function calls are made after fatal errors are detected and\n\u003e program termination is desired. ExitProcess(), however causes\n\u003e _orderly_ shutdown of a process and all its threads, i.e. it unloads\n\u003e all dlls and runs all destructors. See MSDN for details of exactly\n\u003e what happens\n\u003e (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v\u003dvs.85).aspx).\n\u003e The MSDN page states that ExitProcess should never be called unless\n\u003e it is _known to be safe_ to call it. These calls should simply be\n\u003e replaced with calls to TerminateProcess(), which is what should be\n\u003e called for _disorderly_ shutdown.\n\u003e\n\u003e An example of usage:\n\u003e\n\u003e ```\n\u003e TerminateProcess(GetCurrentProcess(), exitcode);\n\u003e ```\n\u003e\n\u003e Effect of Problem:\n\u003e Because of a compilation error (wrong c++ runtime), my program\n\u003e executed the uplink.c ExitProcess() call. This caused the single\n\u003e OpenSSL thread to start executing the destructors of all my dlls,\n\u003e and their objects. Unfortunately, about 30 other threads were\n\u003e happily using those objects at that time, eventually causing a\n\u003e 0xC0000005 ACCESS_VIOLATION. Obviously an ACCESS_VIOLATION is the\n\u003e best case scenario, as I'm sure you can imagine at the consequences\n\u003e of undiscovered memory corruption, even in a terminating process.\n\nAnd on the subject of `TerminateProcess()` being asynchronous:\n\n\u003e That is technically true, but I think it's probably synchronous\n\u003e \u0022enough\u0022 for your purposes, since a call to TerminateProcess\n\u003e suspends execution of all threads in the target process. This means\n\u003e it's really only asynchronous if you're calling TerminateProcess one\n\u003e some _other_ process. If you're calling TerminateProcess on your own\n\u003e process, you'll never return from the TerminateProcess call.\n\nFixes #2489\nWas originally RT-4526\n\nReviewed-by: Matt Caswell \u003cmatt@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/8301)\n\n(cherry picked from commit 925795995018bddb053e863db8b5c52d2a9005d9)\n"
,
"diff": "diff --git a/ms/uplink.c b/ms/uplink.c\nindex 7f7abfb..2096f2c 100644\n--- a/ms/uplink.c\n+++ b/ms/uplink.c\n@@ -28,7 +28,7 @@ static TCHAR msg[128];\n static void unimplemented(void)\n {\n OPENSSL_showfatal(sizeof(TCHAR) \u003d\u003d sizeof(char) ? \u0022%s\u005cn\u0022 : \u0022%S\u005cn\u0022, msg);\n- ExitProcess(1);\n+ TerminateProcess(GetCurrentProcess(), 1);\n }\n \n void OPENSSL_Uplink(volatile void **table, int index)\n","s":{"c":1752666884,"u": 38307}}
],"g": 39670,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}