<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63697>63697</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            UBSAN stuck in a loop at `sigaction ()`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          abhi-k9
      </td>
    </tr>
</table>

<pre>
    Architecture:
`Linux my-machine 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Thu May 18 10:27:05 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux`

Flags:
`-fsanitize=undefined -fno-sanitize=vptr`

Compiler:
```
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 1717c18664d5880f78db85eb0075a2c1379df2d9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```

GDB Ouput:
```
Program received signal SIGINT, Interrupt.
GetHandleSignalMode () at /home/git_x86/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1874
1874 HandleSignalMode result = GetHandleSignalModeImpl(signum);
(gdb) n
1875      if (result == kHandleSignalYes && !common_flags()->allow_user_segv_handler)
(gdb) n
GetHandleSignalMode () at /home/git_x86/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1878
1878 }
(gdb) n
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:68
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function __interceptor_sigaction@plt,
which has no line number information.
__interceptor_sigaction () at /home/git_x86/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_signal_interceptors.inc:63
63 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
(gdb) n
64        if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
(gdb) n
68 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
(gdb) n
0x00007ffff6e6cc51 in sigaction () from /home/me/libABC.so
(gdb) n
Single stepping until exit from function sigaction,
which has no line number information.
0x00007ffff7249da0 in __interceptor_sigaction@plt () from /home/me/libABC.so
```

This just keeps on repeating and never escapes. I would appreciate any help.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsmc9u2zgXxZ-G3lxYoEhLohd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