From patchwork Tue Sep 9 23:31:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 2717 Received: (qmail 6332 invoked by alias); 9 Sep 2014 23:31:26 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6317 invoked by uid 89); 9 Sep 2014 23:31:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <1410305478.27502.10.camel@bordewijk.wildebeest.org> Subject: Bug 16713 - [s390x] Member "sa_flags" does not have the correct type From: Mark Wielaard To: Stefan Liebler Cc: libc-alpha@sourceware.org Date: Wed, 10 Sep 2014 01:31:18 +0200 Mime-Version: 1.0 Hi, [Sorry for the duplicate Stefan, I got the list name wrong on the CC.] To fix the following bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16713 There was this simple change: But means glibc and the kernel don't agree anymore on the structure layout of struct sigaction. The kernel is still using unsigned long sa_flags on s390. I guess this still works out because all current SA_... flag values fit in an int. But it does mean the kernel cannot expand the flag field values anymore in the future. Because valgrind follows the kernel definition the above change causes valgrind memcheck to complain now whenever only the sa_flags value (as seen by user space) is assigned. For example in nptl-init.c: struct sigaction sa; sa.sa_sigaction = sigcancel_handler; sa.sa_flags = SA_SIGINFO; __sigemptyset (&sa.sa_mask); (void) __libc_sigaction (SIGCANCEL, &sa, NULL); valgrind will now warn: Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s) at 0x42EECC8: __libc_sigaction (sigaction.c:42) by 0x42E2253: __pthread_initialize_minimal (nptl-init.c:381) by 0x42E15EF: ??? (in /usr/lib64/libpthread-2.19.90.so) Because the '__glibc_reserved0' part of sa_flags as the kernel will see them is indeed undefined. We can easily change valgrind to follow the layout as now used by glibc/user space on s390 instead of the kernel layout and just ignore the __glibc_reserved0 field. But I wanted to first make sure this change/difference between glibc/kernel was intended. Maybe glibc wants to pass the struct as intended by the kernel and needs to create a "bridge" struct that properly initializes the kernel's view of sa_flags? Thanks, Mark --- a/sysdeps/unix/sysv/linux/s390/bits/sigaction.h +++ b/sysdeps/unix/sysv/linux/s390/bits/sigaction.h @@ -43,7 +43,8 @@ struct sigaction #endif /* Special flags. */ - unsigned long int sa_flags; + int __glibc_reserved0; + int sa_flags; /* Restore handler. */ void (*sa_restorer) (void);