| 1801 | } |
| 1802 | |
| 1803 | void sigsegvHandler(int sig, siginfo_t *info, void *secret) { |
| 1804 | UNUSED(secret); |
| 1805 | UNUSED(info); |
| 1806 | |
| 1807 | bugReportStart(); |
| 1808 | serverLog(LL_WARNING, |
| 1809 | "Redis %s crashed by signal: %d, si_code: %d", REDIS_VERSION, sig, info->si_code); |
| 1810 | if (sig == SIGSEGV || sig == SIGBUS) { |
| 1811 | serverLog(LL_WARNING, |
| 1812 | "Accessing address: %p", (void*)info->si_addr); |
| 1813 | } |
| 1814 | if (info->si_code <= SI_USER && info->si_pid != -1) { |
| 1815 | serverLog(LL_WARNING, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid); |
| 1816 | } |
| 1817 | |
| 1818 | #ifdef HAVE_BACKTRACE |
| 1819 | ucontext_t *uc = (ucontext_t*) secret; |
| 1820 | void *eip = getMcontextEip(uc); |
| 1821 | if (eip != NULL) { |
| 1822 | serverLog(LL_WARNING, |
| 1823 | "Crashed running the instruction at: %p", eip); |
| 1824 | } |
| 1825 | |
| 1826 | logStackTrace(getMcontextEip(uc), 1); |
| 1827 | |
| 1828 | logRegisters(uc); |
| 1829 | #endif |
| 1830 | |
| 1831 | printCrashReport(); |
| 1832 | |
| 1833 | #ifdef HAVE_BACKTRACE |
| 1834 | if (eip != NULL) |
| 1835 | dumpCodeAroundEIP(eip); |
| 1836 | #endif |
| 1837 | |
| 1838 | bugReportEnd(1, sig); |
| 1839 | } |
| 1840 | |
| 1841 | void printCrashReport(void) { |
| 1842 | /* Log INFO and CLIENT LIST */ |
nothing calls this directly
no test coverage detected