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:
parent
431f94725f
commit
6a0edf0cc3
|
|
@ -13,8 +13,29 @@ static gid_t psync_gid;
|
||||||
static gid_t *psync_gids;
|
static gid_t *psync_gids;
|
||||||
static int psync_gids_cnt;
|
static int psync_gids_cnt;
|
||||||
|
|
||||||
__attribute__((weak)) void psys_debug_abort_on_sqllock(uint64_t millisec) {}
|
static void psys_debug_abort_on_sqllock(uint64_t millisec) {
|
||||||
__attribute__((weak)) void psys_debug_configure_core_dump() {}
|
#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) {
|
static void abort_on_sqllock(uint64_t millisec) {
|
||||||
psys_debug_abort_on_sqllock(millisec);
|
psys_debug_abort_on_sqllock(millisec);
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ gid_t *psys_get_gids();
|
||||||
int psys_get_gids_cnt();
|
int psys_get_gids_cnt();
|
||||||
|
|
||||||
void psys_init();
|
void psys_init();
|
||||||
void psys_debug_abort_on_sqllock(uint64_t millisec);
|
|
||||||
void psys_debug_configure_core_dump();
|
|
||||||
time_t psys_time_seconds();
|
time_t psys_time_seconds();
|
||||||
uint64_t psys_time_milliseconds();
|
uint64_t psys_time_milliseconds();
|
||||||
void psys_sleep_milliseconds(uint64_t millisec);
|
void psys_sleep_milliseconds(uint64_t millisec);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue