Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760344AbcCDWWr (ORCPT ); Fri, 4 Mar 2016 17:22:47 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:34939 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759080AbcCDWWp (ORCPT ); Fri, 4 Mar 2016 17:22:45 -0500 MIME-Version: 1.0 In-Reply-To: <1456781345-8243-2-git-send-email-stsp@list.ru> References: <1456781345-8243-1-git-send-email-stsp@list.ru> <1456781345-8243-2-git-send-email-stsp@list.ru> From: Andy Lutomirski Date: Fri, 4 Mar 2016 14:22:24 -0800 Message-ID: Subject: Re: [PATCH 1/2] sigaltstack: implement SS_AUTODISARM flag To: Stas Sergeev Cc: Ingo Molnar , Peter Zijlstra , Richard Weinberger , Andrew Morton , Oleg Nesterov , Tejun Heo , Heinrich Schuchardt , Jason Low , Andrea Arcangeli , Frederic Weisbecker , Konstantin Khlebnikov , Josh Triplett , "Eric W. Biederman" , Aleksa Sarai , "Amanieu d'Antras" , Paul Moore , Sasha Levin , Palmer Dabbelt , Vladimir Davydov , "linux-kernel@vger.kernel.org" , Linux API , Stas Sergeev Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 715 Lines: 15 On Mon, Feb 29, 2016 at 1:29 PM, Stas Sergeev wrote: > This patch implements the SS_AUTODISARM flag that can be ORed with > SS_ONSTACK when forming ss_flags. > When this flag is set, sigaltstack will be disabled when entering > the signal handler; more precisely, after saving sas to uc_stack. > When leaving the signal handler, the sigaltstack is restored by > uc_stack. > When this flag is used, it is safe to switch from sighandler with > swapcontext(). Without this flag, the subsequent signal will corrupt > the state of the switched-away sighandler. > This looks reasonable to me with one exception: how does a user program detect the presence of this feature? Anyone else have any thoughts?