[compiler-rt] [MSan] Fix wrong unpoison size in SignalAction (PR #144071)

Kunqiu Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 13 23:59:21 PDT 2025


Camsyn wrote:

> lgtm, wonder if we can add a test?

We cannot.

Due to `sizeof(sigaction) > sizeof(siginfo_t)`, the original mistake should have caused MSan's FN (as the overly unpoisoning).

I did try to design a test to trigger this FN via user-customized signal stack (`siginfo` and `ucontext` are located in the stack).
However, in glibc-2.39, it holds that  
$\[\mathrm{siginfo}, \mathrm{siginfo + size_{siginfo}}\) \in \[\mathrm{siginfo}, \mathrm{siginfo + size_{sigaction}}\)  \in \[\mathrm{uc}, \mathrm{uc + size_{uc}}\)$.

Accordingly, we cannot produce a FN as MSAN also unpoison the third parameter by ` __msan_unpoison(uc, ucontext_t_sz(uc))`.

Anyway, the POSIX standard does not specify that the second argument must be contained by the third parameter. Therefore, we still unpoison the `si`.




https://github.com/llvm/llvm-project/pull/144071


More information about the llvm-commits mailing list