Fix pcl-ivv: remove weak attribute from debug hooks (#362)

Removed weak attribute from debug hooks (psys_debug_abort_on_sqllock and psys_debug_configure_core_dump). Made functions static in psys.c and removed declarations from psys.h. Functions can no longer be overridden by external libraries, preventing potential code execution and security bypass.

Fixes #289

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
This commit is contained in:
Levi Neely 2026-03-07 20:18:51 +01:00 committed by GitHub
parent 431f94725f
commit 6a0edf0cc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 4 deletions

View File

@ -13,8 +13,29 @@ static gid_t psync_gid;
static gid_t *psync_gids;
static int psync_gids_cnt;
__attribute__((weak)) void psys_debug_abort_on_sqllock(uint64_t millisec) {}
__attribute__((weak)) void psys_debug_configure_core_dump() {}
static void psys_debug_abort_on_sqllock(uint64_t millisec) {
#ifdef DEBUG
if (psql_locked()) {
pdbg_logf(D_CRITICAL, "trying to sleep while holding sql lock, aborting");
psql_dump_locks();
abort();
}
#else
(void)millisec;
#endif
}
static void psys_debug_configure_core_dump() {
#ifdef DEBUG
struct rlimit limit;
if (getrlimit(RLIMIT_CORE, &limit))
pdbg_logf(D_ERROR, "getrlimit failed errno=%d", errno);
else {
limit.rlim_cur = limit.rlim_max;
if (setrlimit(RLIMIT_CORE, &limit))
pdbg_logf(D_ERROR, "setrlimit failed errno=%d", errno);
}
#endif
}
static void abort_on_sqllock(uint64_t millisec) {
psys_debug_abort_on_sqllock(millisec);

View File

@ -13,8 +13,6 @@ gid_t *psys_get_gids();
int psys_get_gids_cnt();
void psys_init();
void psys_debug_abort_on_sqllock(uint64_t millisec);
void psys_debug_configure_core_dump();
time_t psys_time_seconds();
uint64_t psys_time_milliseconds();
void psys_sleep_milliseconds(uint64_t millisec);