<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmocom-bb/+/21348">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trxcon: generate coredump and exit upon SIGABRT received<br><br>Previous code relied on abort() switching sigaction to SIG_FDL +<br>retriggering SIGABRT in case the signal handler returns, which would<br>then generate the coredump + terminate the process.<br>However, if a SIGABRT is received from somewhere else (kill -SIGABRT),<br>then the process would print the talloc report and continue running,<br>which is not desired.<br><br>Change-Id: I6d80f3f2742d397e47f4f2970c951f2cf6d58172<br>Fixes: OS#4865<br>---<br>M src/host/trxcon/trxcon.c<br>1 file changed, 13 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c</span><br><span>index e14e2c9..158e27f 100644</span><br><span>--- a/src/host/trxcon/trxcon.c</span><br><span>+++ b/src/host/trxcon/trxcon.c</span><br><span>@@ -241,15 +241,25 @@</span><br><span>        app_data.quit = 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void signal_handler(int signal)</span><br><span style="color: hsl(120, 100%, 40%);">+static void signal_handler(int signum)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-  fprintf(stderr, "signal %u received\n", signal);</span><br><span style="color: hsl(120, 100%, 40%);">+    fprintf(stderr, "signal %u received\n", signum);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  switch (signal) {</span><br><span style="color: hsl(120, 100%, 40%);">+     switch (signum) {</span><br><span>    case SIGINT:</span><br><span>                 app_data.quit++;</span><br><span>             break;</span><br><span>       case SIGABRT:</span><br><span style="color: hsl(120, 100%, 40%);">+         /* in case of abort, we want to obtain a talloc report and</span><br><span style="color: hsl(120, 100%, 40%);">+             * then run default SIGABRT handler, who will generate coredump</span><br><span style="color: hsl(120, 100%, 40%);">+                * and abort the process. abort() should do this for us after we</span><br><span style="color: hsl(120, 100%, 40%);">+               * return, but program wouldn't exit if an external SIGABRT is</span><br><span style="color: hsl(120, 100%, 40%);">+             * received.</span><br><span style="color: hsl(120, 100%, 40%);">+           */</span><br><span style="color: hsl(120, 100%, 40%);">+           talloc_report_full(tall_trxcon_ctx, stderr);</span><br><span style="color: hsl(120, 100%, 40%);">+          signal(SIGABRT, SIG_DFL);</span><br><span style="color: hsl(120, 100%, 40%);">+             raise(SIGABRT);</span><br><span style="color: hsl(120, 100%, 40%);">+               break;</span><br><span>       case SIGUSR1:</span><br><span>        case SIGUSR2:</span><br><span>                talloc_report_full(tall_trxcon_ctx, stderr);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmocom-bb/+/21348">change 21348</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmocom-bb/+/21348"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6d80f3f2742d397e47f4f2970c951f2cf6d58172 </div>
<div style="display:none"> Gerrit-Change-Number: 21348 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>