1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-03-09 17:59:19 +03:00

Compare commits

...

16 Commits

Author SHA1 Message Date
b551b77e25 Merge pull request #2225 from synqa/tsan-disable-macro
Add macro to disable thread sanitizer
2026-02-08 17:26:26 +01:00
609b8f4a5e Merge pull request #2224 from synqa/revert-2221-fix-halt-flag
Revert "Fix data race on Tick64"
2026-02-08 17:25:04 +01:00
0a87ff8fbd Add macro to disable thread sanitizer
Define ATTRIBUTE_NO_TSAN as __attribute__((no_sanitize(\"thread\")))
when building with thread sanitizer enabled. Falls back to empty
definition when thread sanitizer is not active or not supported
compiler.
2026-02-08 23:41:10 +09:00
6016f84315 Revert "Fix data race on Tick64" 2026-02-08 23:14:09 +09:00
9d27b935b7 Merge pull request #2223 from synqa/fix-memory-leak-loadlanglist
Fix memory leak in LoadLangList()
2026-02-06 15:56:18 +01:00
1e1104d3ba Merge pull request #2221 from synqa/fix-halt-flag
Fix data race on Tick64
2026-02-06 15:55:01 +01:00
074efb5479 Merge pull request #2220 from synqa/fix-thread-counter
Fix race condition in thread counter
2026-02-06 15:54:18 +01:00
fe460de5a6 Fix data race on Tick64
Add lock protection when reading/writing Halt flag to prevent data race.
2026-02-06 21:12:16 +09:00
6ef941db21 Fix memory leak in LoadLangList() 2026-02-06 21:08:52 +09:00
d7d3ec8cac Fix race condition in thread counter
To prevent data races caused by concurrent access from multiple threads,
replace UINT with COUNTER.
2026-02-06 21:03:08 +09:00
68e9f0b593 Merge pull request #2218 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/webpack-5.105.0
Build(deps-dev): Bump webpack from 5.94.0 to 5.105.0 in /src/bin/hamcore/wwwroot/admin/default
2026-02-06 07:35:07 +01:00
f1012da5fb Build(deps-dev): Bump webpack in /src/bin/hamcore/wwwroot/admin/default
Bumps [webpack](https://github.com/webpack/webpack) from 5.94.0 to 5.105.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack/compare/v5.94.0...v5.105.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.105.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-05 23:11:11 +00:00
1411d4ceb4 Merge pull request #2217 from synqa/fix-preserve-errno
Fix preserve errno in SIGCHLD signal handler
2026-02-05 15:46:13 +01:00
a3176175f9 Merge pull request #2216 from synqa/fix-ub-leftshift
Fix undefined behavior of left shift
2026-02-05 15:13:46 +01:00
88af7986b4 Fix preserve errno in SIGCHLD signal handler
Signal handler may interrupt code that depends on errno, and waitpid()
may modify errno, therefore, errno must be saved and restored before
returning.
2026-02-05 18:51:58 +09:00
38f102e2e7 Fix undefined behavior of left shift
Left shifting UCHAR promotes it to a signed integer. When the
value is >= 128 and shifted by 24, the result sets the sign bit,
causing undefined behavior. Fixes it by explicit casting to UINT.
2026-02-05 18:48:01 +09:00
6 changed files with 413 additions and 294 deletions

View File

@ -4761,7 +4761,7 @@ static void MY_SHA0_Transform(MY_SHA0_CTX* ctx) {
UCHAR* p = ctx->buf;
int t;
for(t = 0; t < 16; ++t) {
UINT tmp = *p++ << 24;
UINT tmp = (UINT)*p++ << 24;
tmp |= *p++ << 16;
tmp |= *p++ << 8;
tmp |= *p++;

View File

@ -63,7 +63,7 @@ static int ydays[] =
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
static UINT current_num_thread = 0;
static COUNTER *current_num_thread = NULL;
static UINT cached_number_of_cpus = 0;
@ -776,6 +776,7 @@ void InitThreading()
{
thread_pool = NewSk();
thread_count = NewCounter();
current_num_thread = NewCounter();
}
// Release of thread pool
@ -821,6 +822,9 @@ void FreeThreading()
DeleteCounter(thread_count);
thread_count = NULL;
DeleteCounter(current_num_thread);
current_num_thread = NULL;
}
// Thread pool procedure
@ -1028,9 +1032,9 @@ THREAD *NewThreadNamed(THREAD_PROC *thread_proc, void *param, char *name)
Wait(pd->InitFinishEvent, INFINITE);
current_num_thread++;
Inc(current_num_thread);
// Debug("current_num_thread = %u\n", current_num_thread);
// Debug("current_num_thread = %u\n", Count(current_num_thread));
return ret;
}
@ -1055,8 +1059,8 @@ void CleanupThread(THREAD *t)
Free(t);
current_num_thread--;
//Debug("current_num_thread = %u\n", current_num_thread);
Dec(current_num_thread);
//Debug("current_num_thread = %u\n", Count(current_num_thread));
}
// Release thread (pool)

View File

@ -72,11 +72,26 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
// Compiler dependent
#ifndef OS_WIN32
// Gcc compiler
// GCC or Clang compiler
#define GCC_PACKED __attribute__ ((__packed__))
// Clang compiler
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
#define ATTRIBUTE_NO_TSAN __attribute__((no_sanitize("thread")))
#endif // __has_feature(thread_sanitizer)
#endif // __has_feature
// GCC compiler
#if defined(__SANITIZE_THREAD__) && !defined(ATTRIBUTE_NO_TSAN)
#define ATTRIBUTE_NO_TSAN __attribute__((no_sanitize("thread")))
#endif // __SANITIZE_THREAD__
// Other or older Clang/GCC compiler
#ifndef ATTRIBUTE_NO_TSAN
#define ATTRIBUTE_NO_TSAN
#endif // ATTRIBUTE_NO_TSAN
#else // OS_WIN32
// VC++ compiler
#define GCC_PACKED
#define ATTRIBUTE_NO_TSAN
#endif // OS_WIN32
// Macro that displays the current file name and line number

View File

@ -470,6 +470,7 @@ LIST *LoadLangList()
b = ReadDump(filename);
if (b == NULL)
{
FreeLangList(o);
return NULL;
}

View File

@ -2140,9 +2140,13 @@ void UnixMemoryFree(void *addr)
// SIGCHLD handler
void UnixSigChldHandler(int sig)
{
int old_errno = errno;
// Recall the zombie processes
while (waitpid(-1, NULL, WNOHANG) > 0);
signal(SIGCHLD, UnixSigChldHandler);
errno = old_errno;
}
// Disable core dump

File diff suppressed because it is too large Load Diff