https://bugs.kde.org/show_bug.cgi?id=435665
Carl Love <c...@us.ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #137535|0 |1 is obsolete| | Attachment #138168|0 |1 is obsolete| | --- Comment #10 from Carl Love <c...@us.ibm.com> --- Created attachment 138846 --> https://bugs.kde.org/attachment.cgi?id=138846&action=edit PPC add copy, paste, cpabort support Updated patch to add the Memcheck trickery to get Memcheck to detect undefined bits in the copy paste buffer. In comment 9, you mentioned that the dirty handler didn't return a value. Actually it returns the 8-bit CR0 value in a UInt. The suggestion was to have the dirty helper return a UWord. Unfortunately UWord is not defined. I tested using a ULong and a UInt as the dirty helper return value and both seem to work. I went with the UInt as it is a little easier to extract the CR0 value. Not sure if there is something in the trickery that requires ULong instead of UInt? The IRStmt_Exit() call was modified to mask out the lower 8-bits where the CR0 value is returned before comparing against zero. The dirty helper ensures that the upper 24-bits are all zero. Per the suggested testing, I tested with all bits defined. Valgrind does not report an error. When one or all of the buffer bytes are undefined Valgrind reports: =885408== Conditional jump or move depends on uninitialised value(s) ==885408== at 0x180890: test_copy (test_copy_paste1.c:18) ==885408== by 0x180963: main (test_copy_paste1.c:50) as expected. I also tested removing the masking out of the CR0 field and verified the sig trap is generated. The message was: ==836609== Memcheck, a memory error detector ==836609== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==836609== Using Valgrind-3.18.0.GIT and LibVEX; rerun with -h for copyright inf o ==836609== Command: ./test_copy_paste2 ==836609== ==836609== Conditional jump or move depends on uninitialised value(s) ==836609== at 0x180890: test_copy (test_copy_paste2.c:18) ==836609== by 0x180A0F: main (test_copy_paste2.c:79) ==836609== ==836609== ==836609== Process terminating with default action of signal 5 (SIGTRAP) ==836609== at 0x180890: test_copy (test_copy_paste2.c:18) ==836609== by 0x180A0F: main (test_copy_paste2.c:79) ==836609== ==836609== HEAP SUMMARY: ==836609== in use at exit: 0 bytes in 0 blocks ==836609== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==836609== ==836609== All heap blocks were freed -- no leaks are possible ==836609== ==836609== Use --track-origins=yes to see where uninitialised values come from ==836609== For lists of detected and suppressed errors, rerun with: -s ==836609== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Trace/breakpoint trap (core dumped) The code was commented based on Julian's explanation in comment 9 to document how the trickery works. -- You are receiving this mail because: You are watching all bug changes.