From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbbCLHW1 (ORCPT ); Thu, 12 Mar 2015 03:22:27 -0400 Received: from mail-la0-f45.google.com ([209.85.215.45]:46547 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbbCLHWY (ORCPT ); Thu, 12 Mar 2015 03:22:24 -0400 From: Mikael Pettersson X-Google-Original-From: "Mikael Pettersson" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21761.16042.371226.277890@gargle.gargle.HOWL> Date: Thu, 12 Mar 2015 08:22:18 +0100 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 Subject: Re: [PATCH] Don't allow blocking of signals using sigreturn. In-Reply-To: References: <20150311174204.GA5712@pc.thejh.net> <21760.46870.338764.599348@gargle.gargle.HOWL> X-Mailer: VM 8.1.2 under 24.3.1 (x86_64-redhat-linux-gnu) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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.