From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbbCKW0i (ORCPT ); Wed, 11 Mar 2015 18:26:38 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:33809 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbbCKW0f (ORCPT ); Wed, 11 Mar 2015 18:26:35 -0400 MIME-Version: 1.0 In-Reply-To: <21760.46870.338764.599348@gargle.gargle.HOWL> References: <20150311174204.GA5712@pc.thejh.net> <21760.46870.338764.599348@gargle.gargle.HOWL> From: Andy Lutomirski Date: Wed, 11 Mar 2015 15:26:13 -0700 Message-ID: Subject: Re: [PATCH] Don't allow blocking of signals using sigreturn. To: Mikael Pettersson Cc: 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 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 or, even more strangely, with a totally made up context? I suspect that the former does happen, even if the latter may be rare or completely implausible. I certainly have code that modifies GPRs in the context prior to sigreturn. --Andy -- Andy Lutomirski AMA Capital Management, LLC