From owner-freebsd-threads@FreeBSD.ORG Tue Dec 21 22:20:18 2004 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F334916A4D0 for ; Tue, 21 Dec 2004 22:20:17 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B51C243D41 for ; Tue, 21 Dec 2004 22:20:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBLMKH1d025058 for ; Tue, 21 Dec 2004 22:20:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBLMKHEr025057; Tue, 21 Dec 2004 22:20:17 GMT (envelope-from gnats) Resent-Date: Tue, 21 Dec 2004 22:20:17 GMT Resent-Message-Id: <200412212220.iBLMKHEr025057@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-threads@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Archie Cobbs Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 61AAE16A4CE for ; Tue, 21 Dec 2004 22:18:27 +0000 (GMT) Received: from beast.freebsd.org (beast.freebsd.org [216.136.204.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4992143D2D for ; Tue, 21 Dec 2004 22:18:27 +0000 (GMT) (envelope-from archie@FreeBSD.org) Received: from beast.freebsd.org (localhost [127.0.0.1]) by beast.freebsd.org (8.13.1/8.13.1) with ESMTP id iBLMIRfq061758 for ; Tue, 21 Dec 2004 22:18:27 GMT (envelope-from archie@beast.freebsd.org) Received: (from archie@localhost) by beast.freebsd.org (8.13.1/8.13.1/Submit) id iBLMIRtD061757; Tue, 21 Dec 2004 22:18:27 GMT (envelope-from archie) Message-Id: <200412212218.iBLMIRtD061757@beast.freebsd.org> Date: Tue, 21 Dec 2004 22:18:27 GMT From: Archie Cobbs To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: threads/75374: pthread_kill() ignores SA_SIGINFO flag X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Archie Cobbs List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2004 22:20:18 -0000 >Number: 75374 >Category: threads >Synopsis: pthread_kill() ignores SA_SIGINFO flag >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 21 22:20:17 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Archie Cobbs >Release: FreeBSD 5.3-STABLE alpha >Organization: Packet Design >Environment: System: FreeBSD beast.freebsd.org 5.3-STABLE FreeBSD 5.3-STABLE #527: Tue Dec 21 15:02:03 UTC 2004 root@beast.freebsd.org:/usr/src/sys/alpha/compile/BEAST alpha Also happens on FreeBSD 4.10. >Description: When a signal handler is set with the SA_SIGINFO flag, the signal is supposed to be delivered with extra information including the siginfo_t and ucontext_t structures. pthread_kill() seems to ignore this flag, at least when sending the signal to oneself. >How-To-Repeat: /* * Note that the program below prints "info=0x0 ctx=0x0" which shows that * no SA_SIGINFO context is being passed * * Compile: cc -Wall -o bug bug.c -pthread */ #include #include #include #include #include #include #include static void handler(int sig, siginfo_t *info, void *ctx) { printf("info=%p ctx=%p\n", info, ctx); } static void * entry(void *arg) { pthread_kill(pthread_self(), SIGSEGV); return NULL; } int main(int ac, char **av) { struct sigaction sa; pthread_t tid; memset(&sa, 0, sizeof(sa)); sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, SIGSEGV); sa.sa_flags = SA_SIGINFO | SA_NODEFER; sa.sa_sigaction = handler; if (sigaction(SIGSEGV, &sa, NULL) == -1) err(1, "sigaction"); if ((errno = pthread_create(&tid, NULL, entry, NULL)) != 0) err(1, "pthread_create"); if ((errno = pthread_join(tid, NULL)) != 0) err(1, "pthread_join"); return 0; } >Fix: Unknown. >Release-Note: >Audit-Trail: >Unformatted: