Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
openssh-testuser.26950
openssh-7.2p2-blocksigalrm.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-7.2p2-blocksigalrm.patch of Package openssh-testuser.26950
From 39d727accdca6182ced3be3feb774a723b523129 Mon Sep 17 00:00:00 2001 From: Old openssh patches <pcerny@suse.com> Date: Tue, 25 Oct 2022 18:53:05 +0200 Subject: [PATCH] openssh-7.2p2-blocksigalrm # HG changeset patch # Parent 0bfb5dd4b190b546a3e40a59483b2b2884a47c39 block SIGALRM while logging through syslog to prevent deadlocks (through grace_alarm_handler()) bnc#57354 --- log.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/log.c b/log.c index ad12930e..a1d0ed5f 100644 --- a/log.c +++ b/log.c @@ -51,6 +51,7 @@ #endif #include "log.h" +#include <signal.h> static LogLevel log_level = SYSLOG_LEVEL_INFO; static int log_on_stderr = 1; @@ -388,6 +389,7 @@ do_log(LogLevel level, const char *fmt, va_list args) char fmtbuf[MSGBUFSIZ]; char *txt = NULL; int pri = LOG_INFO; + sigset_t nset, oset; int saved_errno = errno; log_handler_fn *tmp_handler; @@ -446,6 +448,14 @@ do_log(LogLevel level, const char *fmt, va_list args) snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); (void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); } else { + /* Prevent a race between the grace_alarm + * which writes a log message and terminates + * and main sshd code that leads to deadlock + * as syslog is not async safe. + */ + sigemptyset(&nset); + sigaddset(&nset, SIGALRM); + sigprocmask(SIG_BLOCK, &nset, &oset); #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); syslog_r(pri, &sdata, "%.500s", fmtbuf); @@ -455,6 +465,7 @@ do_log(LogLevel level, const char *fmt, va_list args) syslog(pri, "%.500s", fmtbuf); closelog(); #endif + sigprocmask(SIG_SETMASK, &oset, NULL); } errno = saved_errno; } -- 2.38.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor