I have created a signal handler for INT 4 ("into" instr) using sigaction but when I get in the handler I find that the values in the context record for some of the registers is different when running valgrind than when running the x86 program. The source to the test program (int4.c) is included below. The output when running the program: windfall-apex% int4 in handler info->si_signo = 11 info->si_errno = 0 info->si_code = 128 context.uc_mcontext.gregs[12] = 4 context.uc_mcontext.gregs[14] = 0x80485c1 Reg 12 is REG_TRAPNO and used by the signal handler for identifying the overflow condition. Reg 14 is REG_EIP and points to the instruction after the offending instruction. Under valgrind 2.4.0 I get: windfall-apex% valgrind int4 ==5482== Memcheck, a memory error detector for x86-linux. ==5482== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. ==5482== Using valgrind-2.4.0, a program supervision framework for x86-linux. ==5482== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al. ==5482== For more details, rerun with: -v ==5482== in handler info->si_signo = 11 info->si_errno = 0 info->si_code = 128 context.uc_mcontext.gregs[12] = 0 context.uc_mcontext.gregs[14] = 0x80485c0 ==5482== ==5482== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 1) ==5482== malloc/free: in use at exit: 0 bytes in 0 blocks. ==5482== malloc/free: 0 allocs, 0 frees, 0 bytes allocated. ==5482== For counts of detected errors, rerun with: -v ==5482== No malloc'd blocks -- no leaks are possible. The bug is that REG_TRAPNO contains 0 instead of 4, and REG_EIP points at the "into" instruction rather than at the following instruction. ----------------------- int4.c --------------------------- #include <signal.h> #include <sys/signal.h> #include <ucontext.h> #include <stdio.h> char *p = 0; void handler(sig, info, context) int sig; siginfo_t *info; ucontext_t *context; { int i; printf("in handler\n"); printf("info->si_signo = %d\n", info->si_signo); printf("info->si_errno = %d\n", info->si_errno); printf("info->si_code = %d\n", info->si_code); /* register 12 is REG_TRAPNO */ /* register 14 is REG_EIP */ printf("context.uc_mcontext.gregs[12] = %d\n", context->uc_mcontext.gregs[12]); printf("context.uc_mcontext.gregs[14] = 0x%x\n", context->uc_mcontext.gregs[14]); exit(0); } int main() { int x = 0x7fffffff; struct sigaction act, oact; int i; bzero(&act, sizeof(struct sigaction)); bzero(&oact, sizeof(struct sigaction)); act.sa_sigaction = &handler; act.sa_flags = SA_SIGINFO; sigaction(SIGSEGV, &act, &oact); x = x*x; /* force overflow flag to be set */ asm("into"); /* signal 4 if overflow bit is set */ printf("returned from handler\n"); }
If the origin Members still active on this or have an Ticket, MR or PR (as in Invent or on the Kanban), can you insert it to the Bug Report? Thank you for the bug report. Unfortunately we were not able to get to it yet. Can we ask you to please check if this is still an issue with either Plasma 5.27 (the current LTS version) or Plasma 6.3 (the latest released version). Regards, [Tizen](https://invent.kde.org/tizen)
Valgrind is a guest in the KDE bug tracker but it does not use KDE development processes so please ignore that last comment.