Date: Thu, 22 May 2014 18:54:18 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Benjamin Kaduk <kaduk@MIT.EDU> Cc: Keno Fischer <kfischer@college.harvard.edu>, freebsd-hackers@freebsd.org Subject: Re: Use of sigreturn(2) in longjmp(3). Message-ID: <20140522155418.GX74331@kib.kiev.ua> In-Reply-To: <alpine.GSO.1.10.1405221124380.25244@multics.mit.edu> References: <CAEoGj__-4A9KwqmjnOdEBfjxheJFpHV8ivo7o4n3ChcxeEq1oQ@mail.gmail.com> <alpine.GSO.1.10.1405221124380.25244@multics.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--5c2rcFySGndwecVE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 22, 2014 at 11:25:32AM -0400, Benjamin Kaduk wrote: > On Thu, 22 May 2014, Keno Fischer wrote: >=20 > > Hello, > > > > The sigreturn manpage states: > > > > "This system call is used by the trampoline code and longjmp(3) when > > returning from a signal to the previously executing program". > > > > Now, I saw the system call in sigtramp.s, but I looked at setjmp.s can't > > find how longjmp does this. Am I missing something totally obvious? >=20 > I expect this is just stale documentation. > Unfortunately, some quick poking at the svn log for=20 > sys/i386/i386/support.s does not make it immediately clear when the code= =20 > changed to not match the documentation. support.s is not related to the issue discussed. Theoretically, sigreturn(2) might be required on some architectures, where the raw access to the usermode CPU state requires supervisor CPU state. AFAIK all architectures FreeBSD runs on either do not have this quirk, or limit the state saved and restored in the setjmp/longjmp functions, to the state accessible to the usermode. For instance, even on x86, the TLS base is not saved and consequently not restored by *jmp(3), and cannot be accessed directly by usermode, while sigreturn(2) allows to perform full context modification, including TLS base. Some implementations of longjmp(3)-like functionality, e.g. the one provided by libunwind, do utilize sigreturn(2) to unwind over the signal frame. --5c2rcFySGndwecVE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTfh2qAAoJEJDCuSvBvK1B9JoP/3uF/9YXkbaZbPEF6LMx50Jk rirhASwIdpOBG5O3oii5+UoxhVcZC2PCLweVtg08HOvqxQAn+6vne27S4B9c/bsw PcAlMuEOyoPq8jvlS7SfNb+QwkYDEIUgtpFUS+dCMo9TPUuhGj5XPNOfwWkQjxef bJT22GRCit5FVOXyD8FDF198OCm2RQBTrhvdi6a6VA0mCdVu/nyYXVSi3/m4LyoS 5d/D0OI+5Q1oWr97ewWEgnt4FbkGYPmcB8mTw4JlOrr9FyG1BR4HAX47zpti8TrQ S5bUScF/ERLyHX/i14O2ZF0h2QofGw02e6YNjoJnLZA0ZltnDEn8p8vSCrvNq1cl iY211MMSoOBLh9qyOG5ZuojGJ0IuiDnbUKmhiyhvnmWjfX2xaY+J52bo2IfJUiuE MBw4raT8Ars29L+aYMd5+yHPiCRJRojFixOoqEdJG6SO3NSb8QVssbKvpbYtJ2DD DrOnqDL2UIYrSLQtF5wda8vc/oH5TLC05WKmulvSmxHKs7lit6JZe/J2ftkfCpdj Sk5Utsoic2Xk3Rroz80hNeeiR0VtkIVyjFZFrOBTeh4suuY5l5veXK47UUKYcNnI 8K+CobSh7jU+mloPj+l1zfeZfpKS4T5Lft4IjFkMSrY48m36FBQxcEQdudtjxk0x BhUfHw7CQXycVsotreci =wu7M -----END PGP SIGNATURE----- --5c2rcFySGndwecVE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140522155418.GX74331>