From owner-freebsd-chat@freebsd.org Thu Feb 14 09:50:35 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E8F514F11BA for ; Thu, 14 Feb 2019 09:50:35 +0000 (UTC) (envelope-from bch@online.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D8CC6801A for ; Thu, 14 Feb 2019 09:50:33 +0000 (UTC) (envelope-from bch@online.de) Received: from online.de ([87.150.247.247]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mj8eB-1hWZ5W2KYP-00f9ct for ; Thu, 14 Feb 2019 10:50:31 +0100 Received: from x230.onfire.org (localhost [127.0.0.1]) by online.de (Postfix) with ESMTP id 214ED6203B for ; Thu, 14 Feb 2019 10:50:31 +0100 (CET) From: Christian Barthel To: freebsd-chat@freebsd.org Subject: siginfo_t content Date: Thu, 14 Feb 2019 10:50:31 +0100 Message-ID: <875ztmitqw.fsf@x230.onfire.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:V00+EHuQy2i8QRILn1Y/3mBHtiucuuA6rZHk/AzTtmhoGuSAxjT GZqYCLmsaF4mOey5noPUHYtHWVUkiunfu1lISYIcfF8XXcL5EqdqaxahUbcTqdYxS/zjPxx tFtfeLvlxcVJxUGr9+/Rjr/yWQK0G8mbL6GUdg8wXD7d5HeKPU3arAIjvfUAebUGt78vkYh VvfdY3E+YQ/u3ilGjmvkw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:6gyEdr7IHxw=:ACrzzeeCCpxotPDHHQOdqS mBmRkrvMGHRcTRhdotsM44V6Bd/LcfWNrqW8kcKmHD4iGqn8ice9JbxfHC1y8ZAq9ZCab4s0e 65+6ywn09f3vYGzncbw3w+5mQtq7YhV4doHY06Do/rN9jbGlS7kSWlwosRatucoiWirQxMypU ww61cJ1ZuE1obwNHTO6IbPXHXxadMF7HsuH0RWnKkzJSFhAAWYDl5ByIqlmqKOP1f+ibuxGlR IK3OwS3neOR3rhAh1gIkKCOLtv7C43WQe+Thrb7KG0V9c+9j+7b0ugX1U0X1I9bQBMooMSIAC Tc4jUeNebiRO3AGnXSPytHLlzA03PGMBfqzblqLSNdfxD7lIDmFHPhWZPkcr0eEUYaZp4Vdo/ ld0Ln4LEcGEGdVYMTOhpscPmLV2pwds1zIM8rtPgw7zQKDLFA2LwWg6lDCamXZiXMW44Qry0P ggIPG24DPRIsMKEy7tdXtwSWsns6LGLQzq2qwgwkl0aNuIMS7sexXLqjmEkxtc2zhxISLs8Wz TABA/KgyD3sCOyyGFZd7tpC0v8rOrTrJJQYxzfN1Tm714/wqL6DLflo3VAwfhr+WaLXpsNYEu CcQ4JYV9R6Ej+am6CS+nu2oqmRu4B6d/78PNmnBCOHEurIpfT3VORNWhRfb47DifrfJlJ51F6 OPmxVIGk12t2ZdwwZsSjobldXGxJ5P06N2qKapxfpg6ty1hozjlTlRbQ95FGRkC4E84w5UFjB c2Ai7mpm0RlIgL0Y7GZY07z1BDMNrmIgHLniPmFjQtNEfHQXqnwIAtY0/ZQ= X-Rspamd-Queue-Id: 3D8CC6801A X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.36 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[10.17.227.212.rep.mailspike.net : 127.0.0.17]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.75)[0.746,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-chat@freebsd.org]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[online.de]; MX_GOOD(-0.01)[cached: mx00.emig.kundenserver.de]; NEURAL_SPAM_LONG(0.67)[0.668,0]; RCVD_IN_DNSWL_NONE(0.00)[10.17.227.212.list.dnswl.org : 127.0.5.0]; NEURAL_SPAM_MEDIUM(0.82)[0.818,0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[247.247.150.87.zen.spamhaus.org : 127.0.0.10]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(0.24)[ipnet: 212.227.0.0/16(-0.77), asn: 8560(1.95), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 09:50:36 -0000 Hello, I am interested in the historical development of the siginfo_t record. I hope, this is the correct mailinglist and there are still readers on it. I've tried to write a very simple and minimalistic profiler for a single threaded application by using setitimer(2) and SIGPROF signal. When using the extended signal handler code described in the EXAMPLES section of sigaction(2), I can access the faulting code and the type of the signal by using `struct siginfo`: File: struct siginfo_t *info { .... int si_code; /* signal code */ void *si_addr; /* faulting instruction */ .... } I've noticed that the si_code is always set to be SI_KERNEL and the si_addr to be 0x0. Is there a specific reason for this? I thought that the SIGPROF signal would be of type SI_TIMER. After reading through the kernel sources, I've manipulated the returned structure a bit and attached the patch to clarify what I am meaning (I've just used the program counter of the first thread which is not correct if there are multiple threads). Kind regards, -- Christian Barthel From owner-freebsd-chat@freebsd.org Thu Feb 14 20:20:48 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2757F14E0010 for ; Thu, 14 Feb 2019 20:20:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8A3889A61; Thu, 14 Feb 2019 20:20:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 63FCA8466; Thu, 14 Feb 2019 20:20:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: siginfo_t content To: Christian Barthel , freebsd-chat@freebsd.org References: <875ztmitqw.fsf@x230.onfire.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <12fe52ea-1ab7-58b0-26d2-2c393570dd2f@FreeBSD.org> Date: Thu, 14 Feb 2019 12:20:45 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <875ztmitqw.fsf@x230.onfire.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B8A3889A61 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 20:20:48 -0000 On 2/14/19 1:50 AM, Christian Barthel wrote: > Hello, > I am interested in the historical development of the siginfo_t > record. I hope, this is the correct mailinglist and there are > still readers on it. > > I've tried to write a very simple and minimalistic profiler for a > single threaded application by using setitimer(2) and SIGPROF > signal. When using the extended signal handler code described in > the EXAMPLES section of sigaction(2), I can access the faulting > code and the type of the signal by using `struct siginfo`: > > File: > struct siginfo_t *info { > .... > int si_code; /* signal code */ > void *si_addr; /* faulting instruction */ > .... > } > > I've noticed that the si_code is always set to be SI_KERNEL and > the si_addr to be 0x0. Is there a specific reason for this? > > I thought that the SIGPROF signal would be of type SI_TIMER. > After reading through the kernel sources, I've manipulated the > returned structure a bit and attached the patch to clarify what I > am meaning (I've just used the program counter of the first > thread which is not correct if there are multiple threads). See the siginfo(3) manpage. SI_TIMER is described there as: SI_TIMER signal generated by expiration of a timer set by timer_settime(2) It is not for setitimer. Similarly, si_addr is usually only specified for synchronous signals and usually holds the PC of the faulting instruction except for SIGSEGV when it holds the faulting virtual address. -- John Baldwin                                                                              From owner-freebsd-chat@freebsd.org Fri Feb 15 12:02:21 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4C114D882E for ; Fri, 15 Feb 2019 12:02:21 +0000 (UTC) (envelope-from tal@whatexit.org) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85D688DE32 for ; Fri, 15 Feb 2019 12:02:16 +0000 (UTC) (envelope-from tal@whatexit.org) Received: by mail-qt1-x832.google.com with SMTP id d18so465451qtg.12 for ; Fri, 15 Feb 2019 04:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whatexit.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GVT02Hq+8AV+G5sL6pZNS6yL31U6GumHRc+4sBs3E3w=; b=u2DqxMFpIobMApJGnPUmIHdl83aDk6k+vUpuUPgLR16hy519D5NL4Hx6YhMqWWy0hV GiE3/qZZKa4CxrHiukCcZu3Y2pFWwF8YdzCAs2LPpONcvo0fb7zlbllIJvRwP35DOAmy ULdSdOD4VwQZJlX8tf18u2SOyQ7GiDqKAsfxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GVT02Hq+8AV+G5sL6pZNS6yL31U6GumHRc+4sBs3E3w=; b=tMajBsonrd77lEMtTntzBp///sfIp3FZo/uVHJh+MvSNZg5CeREikCLE0tfGJ19z5U nB5EklF2LUUuZQJ7SIH6M0r7s2/MCe02m5HzuV3JybTNAmEWhtky5GCCrLtZCQlN7t6p JDrPHJ8bwraipPaoHSgcpgEI+8zK3EWsj0AxMXSxsXZudu6SWZ5+tUMg5w8MV3nvhuVN QUs0Qey2YmT0hzj8s/jhAS9rdq77tSKUDowuoTGxltPczMBZwJW1zCXTKQwWz5Lryiww Pzwbh6Uw5V70Wg4sOA1T1xAsig5jkexngrQ5SaRXSqcPzkiZSfwdkd9yw236CVmGfmpK q4HQ== X-Gm-Message-State: AHQUAuaA8ustt1K+EkeOgPX4VWwZx2ic/rgV4ES8zlFKJ5sCACrv9788 LT+mGZydNl8e13eVfTcrD0UxSHXACJCv8lf7jdKVNSBs0jigkQ== X-Google-Smtp-Source: AHgI3IZnNbluPjpemcJvSrjFl7OQ83NIgL0NRR1zErsJ9SeJW6nefIcV5d8vCY0+cz/1A2MnGt0eeMiZSrQodBJj8MQ= X-Received: by 2002:ac8:160d:: with SMTP id p13mr7322666qtj.20.1550232135717; Fri, 15 Feb 2019 04:02:15 -0800 (PST) MIME-Version: 1.0 References: <875ztmitqw.fsf@x230.onfire.org> In-Reply-To: <875ztmitqw.fsf@x230.onfire.org> From: Tom Limoncelli Date: Fri, 15 Feb 2019 07:02:04 -0500 Message-ID: Subject: Re: siginfo_t content To: Christian Barthel Cc: freebsd-chat@freebsd.org X-Rspamd-Queue-Id: 85D688DE32 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=whatexit.org header.s=google header.b=u2DqxMFp; spf=pass (mx1.freebsd.org: domain of tal@whatexit.org designates 2607:f8b0:4864:20::832 as permitted sender) smtp.mailfrom=tal@whatexit.org X-Spamd-Result: default: False [-5.17 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[whatexit.org:s=google]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-chat@freebsd.org]; DMARC_NA(0.00)[whatexit.org]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[whatexit.org:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com]; IP_SCORE(-2.71)[ip: (-8.93), ipnet: 2607:f8b0::/32(-2.57), asn: 15169(-1.99), country: US(-0.07)]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 12:02:21 -0000 On Thu, Feb 14, 2019 at 4:50 AM Christian Barthel wrote: > Hello, > I am interested in the historical development of the siginfo_t > record. I hope, this is the correct mailinglist and there are > still readers on it. > The historical development of siginfo_t is actually quite interesting. I'm glad you asked. siginfo_t was born in Riverside, Iowa, in the year 1983, where he was raised by his parents, procinfo_t and fsinfo_t. siginfo_t learned to read at a very early age. His teachers considered him to be exceptionally smart, though he was considered very impatient as he was fond of interrupting people. After high school he attended UC Berkeley, where he majored in computer science with an emphasis on operating systems. He interned at Bell Labs two summers. His began graduate studies at Stanford but didn't complete his degree, after a series of contentious disagreements with his instructors. He was always faulting instructors, and eventually the university signaled that he was done. siginfo_t currently works at a startup in California. Tom -- Email: tal@whatexit.org Work: tlimoncelli@StackOverflow.com Blog: http://EverythingSysadmin.com/ From owner-freebsd-chat@freebsd.org Fri Feb 15 16:43:37 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E633314E085C for ; Fri, 15 Feb 2019 16:43:36 +0000 (UTC) (envelope-from bch@online.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90906717AE; Fri, 15 Feb 2019 16:43:35 +0000 (UTC) (envelope-from bch@online.de) Received: from online.de ([87.167.43.155]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MtOT0-1hCcPD3axC-00uqsQ; Fri, 15 Feb 2019 17:43:25 +0100 Received: from x230.onfire.org (localhost [127.0.0.1]) by online.de (Postfix) with ESMTP id 254B9620C7; Fri, 15 Feb 2019 17:43:24 +0100 (CET) From: Christian Barthel To: John Baldwin Cc: freebsd-chat@freebsd.org Subject: Re: siginfo_t content References: <875ztmitqw.fsf@x230.onfire.org> <12fe52ea-1ab7-58b0-26d2-2c393570dd2f@FreeBSD.org> Date: Fri, 15 Feb 2019 17:43:24 +0100 In-Reply-To: <12fe52ea-1ab7-58b0-26d2-2c393570dd2f@FreeBSD.org> (John Baldwin's message of "Thu, 14 Feb 2019 12:20:45 -0800") Message-ID: <87sgwpovdf.fsf@x230.onfire.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:KqtFCzSfftzrTfd0QHqDyIoRNSwpyveVmYac+3y116oR+Q9XoRI Go0rLDiTB/9kIJvLBYooHLinzpUQP0OjrarcEBMqswFWS4xNpHTsSSNb0ek8yfbiVsojwFm JiBVjZA0sZbqzTxAlxUraCJ+qUF2Mt64e9Q9jrMTS/t5XMZoZmciclzRwL1WOsdinu1nP0B cqDuyBR29MTQeSvg3z6ng== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:E2wgjRwktoU=:CGm4G6VTkszj4EFzU9hCuq Fcc2kqECSJn3ZpupIAeGq4/CVOrOzEdSvGdLE9K3+WUX+51gFeG+BpKGQUEKjbUUyUVFzWYbP xhw5vej/VBwDkJZ/XpJ17i6di5TN/fwlKZrzKuhNvHE9m31D3Kj9e7CutRLKyEXxch3RZ/eJP PlxgHHsjCxFquh1sE4lgaJiYAql89mAwwLddGNy+RoS7kc6mtixquEwD5Vi0oSa/gJF5d7kYm cdiCcbH51LpAijVTJLZO89qnN3qURfEZwplTrRfLo+I1qOsH+0IEMBqKmEUyB4KqkZXkK1ea5 IkQRcfC4kNhcThlO39pMn80TVm2myKnFjz+EqtDVDnd4f1Z4ZU6R/Vt6nLwHKWdXhqQdlO750 pkr4RqUHHgPXwMKVcMoWXFwg/XOKebD7i/iyjMt/32+7wyrFKNBIf4qCqSJNLsSKOy9FnHqMn T9Z/1GKAwqf0AxAPriTe65bKB9s5XwrUBBFMBEcOdc64RJUWTDESQLYkxZZv6wbsnT75ry+Yg lZBLgC62tluaQls/9KVFsZFxctdUfs35DXu5fTF7lmn6Kb1+qHw3fGWhpls6i8KGTI27zkl8e Tt4gFmPMEc3tYi3rnWXn2b/QG7bds4OEGVuz7lL3X+DMJDcFZk14a3Fbg0dxIIGzktuNSpaOq 7Um1kmxY4ZZLqkODzvH9vTTChaZk0lfgkxLyGBmv1SWRk6i44S1O6xap8AHXY6xX4fTtUBL4b DGFOJNzl44Cf62mUNYuM1kd8L2W/lWQ9VsQ5MIx2uS0CTNA3D/3SiUee9ws= X-Rspamd-Queue-Id: 90906717AE X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.69 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[mx01.emig.kundenserver.de,mx00.emig.kundenserver.de]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[155.43.167.87.zen.spamhaus.org : 127.0.0.10]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.86)[0.860,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[online.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.97)[0.970,0]; IP_SCORE(0.24)[ip: (0.09), ipnet: 212.227.0.0/16(-0.81), asn: 8560(1.93), country: DE(-0.01)]; NEURAL_SPAM_LONG(0.73)[0.725,0]; RCVD_IN_DNSWL_NONE(0.00)[135.126.227.212.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[] X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 16:43:37 -0000 John Baldwin writes: > See the siginfo(3) manpage. SI_TIMER is described there as: > > SI_TIMER signal generated by expiration of a > timer set by timer_settime(2) > > It is not for setitimer. Similarly, si_addr is usually only specified for > synchronous signals and usually holds the PC of the faulting instruction > except for SIGSEGV when it holds the faulting virtual address. Thanks for your reply. Ah, yes, siginfo(3) has more details on siginfo_t (missed that one; sorry). This clarifies my question. I've looked up the POSIX standard but I haven't seen a reason why si_addr is only set for SIGSEGV and "only" a few others - are there reasons for this? -- Christian Barthel From owner-freebsd-chat@freebsd.org Fri Feb 15 18:12:16 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE54914E3958 for ; Fri, 15 Feb 2019 18:12:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 558B9759E8; Fri, 15 Feb 2019 18:12:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id E767711427; Fri, 15 Feb 2019 18:12:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: siginfo_t content To: Christian Barthel Cc: freebsd-chat@freebsd.org References: <875ztmitqw.fsf@x230.onfire.org> <12fe52ea-1ab7-58b0-26d2-2c393570dd2f@FreeBSD.org> <87sgwpovdf.fsf@x230.onfire.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <19b54bd0-7e1c-67f2-089b-87350455b3bd@FreeBSD.org> Date: Fri, 15 Feb 2019 10:12:01 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <87sgwpovdf.fsf@x230.onfire.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 558B9759E8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.89)[-0.891,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 18:12:16 -0000 On 2/15/19 8:43 AM, Christian Barthel wrote: > John Baldwin writes: > >> See the siginfo(3) manpage. SI_TIMER is described there as: >> >> SI_TIMER signal generated by expiration of a >> timer set by timer_settime(2) >> >> It is not for setitimer. Similarly, si_addr is usually only specified for >> synchronous signals and usually holds the PC of the faulting instruction >> except for SIGSEGV when it holds the faulting virtual address. > > Thanks for your reply. > Ah, yes, siginfo(3) has more details on siginfo_t (missed that > one; sorry). This clarifies my question. > I've looked up the POSIX standard but I haven't seen a reason why > si_addr is only set for SIGSEGV and "only" a few others - are > there reasons for this? I think it's only intended for use with synchronous traps where the signal is the result of executing an instruction (so si_addr is usually the PC of the instruction triggering the signal). Async events like timers aren't triggered by instructions, so there's no meaningful si_addr to use. However, in a signal handler you can look at the architecture-specific ucontext_t * (3rd argument to handler when using SA_SIGINFO) to determine the PC of the thread at the time it was interrupted by the signal. What are you trying to do exactly? -- John Baldwin                                                                              From owner-freebsd-chat@freebsd.org Fri Feb 15 20:54:50 2019 Return-Path: Delivered-To: freebsd-chat@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E077514E9274 for ; Fri, 15 Feb 2019 20:54:49 +0000 (UTC) (envelope-from bch@online.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9ED9585409; Fri, 15 Feb 2019 20:54:48 +0000 (UTC) (envelope-from bch@online.de) Received: from online.de ([87.167.43.155]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3UIe-1guCH41TAg-000db1; Fri, 15 Feb 2019 21:54:40 +0100 Received: from x230.onfire.org (localhost [127.0.0.1]) by online.de (Postfix) with ESMTP id B1E2462119; Fri, 15 Feb 2019 21:54:39 +0100 (CET) From: Christian Barthel To: John Baldwin Cc: freebsd-chat@freebsd.org Subject: Re: siginfo_t content References: <875ztmitqw.fsf@x230.onfire.org> <12fe52ea-1ab7-58b0-26d2-2c393570dd2f@FreeBSD.org> <87sgwpovdf.fsf@x230.onfire.org> <19b54bd0-7e1c-67f2-089b-87350455b3bd@FreeBSD.org> Date: Fri, 15 Feb 2019 21:54:39 +0100 In-Reply-To: <19b54bd0-7e1c-67f2-089b-87350455b3bd@FreeBSD.org> (John Baldwin's message of "Fri, 15 Feb 2019 10:12:01 -0800") Message-ID: <87wom0lqls.fsf@x230.onfire.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:sgDRcOHPDUwPd7cfGCuA09ujHxBlasJp/n9dCukMRrv/t7emfrV 4I0L7dcilwwUb9hNgRgOwxkA4vHRHdCu11qO17xyzPi1cgVCfsW8+O6yyML75HTAdCnKBXn 8x1Us/AgE6V4jc1zGcM0PzCWFaSR+XCyXHJLKC//AxWE+tgX9mpQGiHaDgXLK3Kr4aQmoFe S4KBpAGElJD8HmJlpp52g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:+jUkw3XdLg0=:bFbcbRkFFjDNvZT64lbCrC ivybBZgAaTn8DgYfimXcUnQYuo1yZNK6EqneZIINkIAPxpiqW1Zko9sasYnPeUrsYWWA0vu7H 5ycZRBPW0nBbdMhkg+1I9zs0za1iSmjs+u/ugHPBTyMfHvVNvnqQ5EL3ClOFVi7gyWo+DgALB /FLBDw2KpI/8R5HNBwTY3gUti4Tqpz739x1GI/hpufgSk70xlxsZ0fslttxFHhZa65CqY7CQg IX7FkCLxV2gJWJqGf1IEQqDaEGnMZCnEzqRu6jE48w999Rdx+Thmax552R1GC5579nKmxpJCJ nPKisWjiO7vObMyrDp32XndxhWmIOCv8sD61eVgEg2mE1MCL+nOyGSuiToejGFg1QcmQfZ2DO XrIYgoREs/L3pEEHqRzkc4lAjxbXQLST6JAQTzC78FuY/FoT1JrNfnW/RaNwAKgnf0+thxqrk GXh6RzS92TvPRrCIxA5lZiB3PE1nqVVhrg+akE5XYA+6rln/qUOHkw1c81B7+AjGJe3bUAX8n o9+V2AIdgHpIO2jISewzXSfmTx4qes9SFboE0lmyPjluHGQeYFK2g5MW9/t69YbX/AFWugcwK L1GrrxoTLQAP0MgRGfa7T2Mz0lPzf+EaQ/aG+2cjgXH1WBqCMe8493gVb8bUXHF3s5eor7mvU UUF2XiuA/tragLrqOg+yXXBcSXfcgOfKFiK3e9eVHL0W1NOaJxgJQ3ZAfqQrfyXi0UEVSZaCg Mt3piTiWjswNUElX42eDuQ5jI7P+q52N1ZE8T4JljxMVVsGHBgHRzESIgY8= X-Rspamd-Queue-Id: 9ED9585409 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.03 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.48)[0.480,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[online.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.94)[0.939,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.15)[ip: (-1.21), ipnet: 217.72.192.0/20(0.04), asn: 8560(1.93), country: DE(-0.01)]; MX_GOOD(-0.01)[cached: mx01.emig.kundenserver.de]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[74.192.72.217.list.dnswl.org : 127.0.5.0]; NEURAL_SPAM_LONG(0.57)[0.573,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[155.43.167.87.zen.spamhaus.org : 127.0.0.10] X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 20:54:50 -0000 John Baldwin writes: > On 2/15/19 8:43 AM, Christian Barthel wrote: >> John Baldwin writes: >> >>> See the siginfo(3) manpage. SI_TIMER is described there as: >>> >>> SI_TIMER signal generated by expiration of a >>> timer set by timer_settime(2) >>> >>> It is not for setitimer. Similarly, si_addr is usually only specified for >>> synchronous signals and usually holds the PC of the faulting instruction >>> except for SIGSEGV when it holds the faulting virtual address. >> >> Thanks for your reply. >> Ah, yes, siginfo(3) has more details on siginfo_t (missed that >> one; sorry). This clarifies my question. >> I've looked up the POSIX standard but I haven't seen a reason why >> si_addr is only set for SIGSEGV and "only" a few others - are >> there reasons for this? > > I think it's only intended for use with synchronous traps where the signal > is the result of executing an instruction (so si_addr is usually the PC of > the instruction triggering the signal). Async events like timers aren't > triggered by instructions, so there's no meaningful si_addr to use. > > However, in a signal handler you can look at the architecture-specific > ucontext_t * (3rd argument to handler when using SA_SIGINFO) to determine > the PC of the thread at the time it was interrupted by the signal. > > What are you trying to do exactly? I've read about profilers at [0] and thought about how to implementing one myself. My initial idea was to setitimer() and keep track of the PC with SIGPROF and calculate "hot regions". Then, I started wondering myself why/how the SIGPROF is meant to be used, since the current program counter was the first thing that came to my mind when thinking about profiling. But I guess, I have to keep track of the current function (or even the stack trace myself and use it within the signal handler to determine hot paths and regions). I know about gprof and DTrace but I am more interested in how to do it on my own and see, how far I can go. [0] https://research.swtch.com/pprof -- Christian Barthel