From owner-freebsd-hackers@freebsd.org Mon Nov 30 00:54:46 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F84246A2B2 for ; Mon, 30 Nov 2020 00:54:46 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkmwP21dXz3sS0 for ; Mon, 30 Nov 2020 00:54:44 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f172.google.com with SMTP id c80so12534596oib.2 for ; Sun, 29 Nov 2020 16:54:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YAEw8pz9L5CxFJ7qdECA6KraUcgO2DCfGr2uJtfMA4c=; b=UOUZUVrpLHjfeQWkDGBv6Jq91+5gpq5idVhWfOwEYfV7NUTvfMIfpnZXlSBVKJSZXA R6A5zwQ5T8+26F1sO0XzCG5Xn12h0kikuoRkJgDo9zk4lHipu6vCaEdfKIPw4aSp7OhA Wgho9BKx7EDrB+OEmdrBb4tKQ9o1geSnQWJcmTP3Fm3/2BtOkHNIjMBd/FSiVxzoYGmZ rVySXfKtiGjC6ysYIUun0KEUwcgmUKPbW5AsJwaxX3p0U/ROFoUPo/p91RS9E0fLFZVl 5s3V1Rvtg1+RrRAjG5/i78zImjUGathhjXgpjigyywGdto0Os3VQeU1UVPyefVfAF7/I 2u9Q== X-Gm-Message-State: AOAM532C54RNy6QEDe+/zCKpFosgsRhOBw84I7QBhrr89H6gR60pUl8g 8Aryj1TJeUjqxnsH+CoUcT6B3KoX+vO6ATmoM0QoESUyvGNtRg== X-Google-Smtp-Source: ABdhPJy/KhXycEksXH/0+4gBmGZBvr9LxlSPKUz7vGOZ0ZrLmgiiIe69QdTkmXdQCFT1jeBenKt1e7ofQGJ8VB6vw8A= X-Received: by 2002:a54:4419:: with SMTP id k25mr12647611oiw.57.1606697683264; Sun, 29 Nov 2020 16:54:43 -0800 (PST) MIME-Version: 1.0 From: Alan Somers Date: Sun, 29 Nov 2020 17:54:32 -0700 Message-ID: Subject: Why don't lio_listio's signals get delivered? To: FreeBSD Hackers X-Rspamd-Queue-Id: 4CkmwP21dXz3sS0 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.172 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; SUBJECT_ENDS_QUESTION(1.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.167.172:from]; TO_DOM_EQ_FROM_DOM(0.00)[]; R_DKIM_NA(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[asomers]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[209.85.167.172:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.172:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.172:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 00:54:46 -0000 I'm investigating https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220398 . What happens is that lio_listio sends a signal to the current process (synchronously, from within the lio_listio syscall itself, not after some I/O completes). With dtrace, I've verified that the signal isn't masked, that it is caught, and that signotify and tdsigwakeup do get called. But after lio_listio returns, the process never receives the signal. If it registers a handler, the handler never gets called. If I set the signal to SIGTERM, the process doesn't get terminated. It's as if the signal is ignored. Asynchronously generated signals still work, however. What's going on? My knowledge of signal-delivery internals is running out, and I would appreciate some help. Steps to reproduce: $ cd /usr/tests/sys/aio $ kyua debug lio_test:lio_listio_empty_nowait_signal Stack trace at the time the signal looks like it's being delivered: kernel`tdsendsignal+0x4e1 kernel`kern_lio_listio+0x493 kernel`sys_lio_listio+0xc2 kernel`amd64_syscall+0x12e kernel`0xffffffff81007e1e lio_listio is attempting to send this signal via aio_sendsig, 24 lines from the bottom of kern_lio_listio. -Alan