From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikael Pettersson Subject: Re: [PATCH] Don't allow blocking of signals using sigreturn. Date: Thu, 12 Mar 2015 08:22:18 +0100 Message-ID: <21761.16042.371226.277890@gargle.gargle.HOWL> References: <20150311174204.GA5712@pc.thejh.net> <21760.46870.338764.599348@gargle.gargle.HOWL> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andy Lutomirski Cc: Mikael Pettersson , Jann Horn , Linux API , "linux-kernel@vger.kernel.org" , Michael Kerrisk , Russell King , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Jeff Dike , Richard Weinberger , Kees Cook , Will Drewry List-Id: linux-api@vger.kernel.org Andy Lutomirski writes: > On Wed, Mar 11, 2015 at 2:43 PM, Mikael Pettersson wrote: > > Jann Horn writes: > > > Or should I throw this patch away and write a patch > > > for the prctl() manpage instead that documents that > > > being able to call sigreturn() implies being able to > > > effectively call sigprocmask(), at least on some > > > architectures like X86? > > > > Well, that is the semantics of sigreturn(). It is essentially > > setcontext() [which includes the actions of sigprocmask()], but > > with restrictions on parameter placement (at least on x86). > > > > You could introduce some setting to restrict that aspect for > > seccomp processes, but you can't change this for normal processes > > without breaking things. > > Which leads to the interesting question: does anyone ever call > sigreturn with a different signal mask than the kernel put there > during signal delivery Yes. Either a sigfillset();sigdelset(SIGSEGV), or a copy of the thread's sigmask from a previous sigframe. > or, even more strangely, with a totally made up > context? Not "totally made up", but certainly with adjustments(*) made to both GPRs and PC. In a different piece of SW: FPU controls. (*) Rolling back or force-committing a micro-transaction until PC+GPRs represent the state at an original instruction boundary. This was in a product using dynamic binary instrumentation.