From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stas Sergeev Subject: Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within sighandler Date: Mon, 1 Feb 2016 21:40:52 +0300 Message-ID: <56AFA6B4.8030808@list.ru> References: <56AE3369.2090709@list.ru> <56AE3626.7080706@list.ru> <20160201160625.GA18276@redhat.com> <20160201170958.GA20735@redhat.com> <56AF955D.7060601@list.ru> <20160201180443.GA21064@redhat.com> <56AFA0E2.1030302@list.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andy Lutomirski Cc: Oleg Nesterov , Linux kernel , Linux API , Ingo Molnar , Peter Zijlstra , Andrew Morton , Amanieu d'Antras , Richard Weinberger , Tejun Heo , "Kirill A. Shutemov" , Jason Low , Heinrich Schuchardt , Andrea Arcangeli , Konstantin Khlebnikov , Josh Triplett , "Eric W. Biederman" , Aleksa Sarai , Paul Moore , Palmer Dabbelt , Vladimir Davydov List-Id: linux-api@vger.kernel.org 01.02.2016 21:28, Andy Lutomirski =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > On Mon, Feb 1, 2016 at 10:16 AM, Stas Sergeev wrote: >> 01.02.2016 21:04, Oleg Nesterov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >>> Yes, and SS_FORCE means "I know what I do", looks very simple. >> But to me its not because I don't know what to do with >> uc_stack after SS_FORCE is applied. >> >>> I won't argue, but to me it would be better to keep this EPERM if != force. >>> Just because we should avoid the incompatible changes if possible. >> Ok then. Lets implement SS_FORCE. >> What semantic should it have wrt uc_stack? >> >> sigaltstack(SS_DISABLE | SS_FORCE); >> swapcontext(); >> sigaltstack(set up new_sas); >> rt_sigreturn(); >> >> What's at the end? Do we want a surprise for the user >> that he's new_sas got ignored? > More detail please. What context are you returning to with > rt_sigreturn? What's in uc_stack? Whatever was saved there by save_altstack_ex() I guess. Which is the sas params on signal entry. And I am returning to the interrupted user context. I am using SA_SIGINFO with sigaction(). This is actually what I was asking you already yeaterday. I don't think SS_FORCE can play nicely with uc_stack and you haven't clarified that part, so lets try again. > Presumably we should continue to honor uc_stack in rt_sigreturn. In this case, the above sigaltstack(set up new_sas) just gets ignored. Are we allright with that? If so, I can code up the patch. Whatever. :) > I'm > less clear on whether we should have an implicit SS_FORCE when > restoring uc_stack. This is obscure and is likely outside of the scope of the problem at hands. > I'm also not clear on why uc_stack exists in the > first place. > > If I were designing this from scratch, I'd have signal delivery for a= n > SA_ONSTACK signal save away the altstack information and clear it so > that nested signals work without checking sp during signal delivery. How would you then evaluate oss->ss_flags? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753298AbcBASlL (ORCPT ); Mon, 1 Feb 2016 13:41:11 -0500 Received: from smtp21.mail.ru ([94.100.179.250]:40978 "EHLO smtp21.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753086AbcBASlH (ORCPT ); Mon, 1 Feb 2016 13:41:07 -0500 Subject: Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within sighandler To: Andy Lutomirski References: <56AE3369.2090709@list.ru> <56AE3626.7080706@list.ru> <20160201160625.GA18276@redhat.com> <20160201170958.GA20735@redhat.com> <56AF955D.7060601@list.ru> <20160201180443.GA21064@redhat.com> <56AFA0E2.1030302@list.ru> Cc: Oleg Nesterov , Linux kernel , Linux API , Ingo Molnar , Peter Zijlstra , Andrew Morton , "Amanieu d'Antras" , Richard Weinberger , Tejun Heo , "Kirill A. Shutemov" , Jason Low , Heinrich Schuchardt , Andrea Arcangeli , Konstantin Khlebnikov , Josh Triplett , "Eric W. Biederman" , Aleksa Sarai , Paul Moore , Palmer Dabbelt , Vladimir Davydov From: Stas Sergeev Message-ID: <56AFA6B4.8030808@list.ru> Date: Mon, 1 Feb 2016 21:40:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mras: Ok Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 01.02.2016 21:28, Andy Lutomirski пишет: > On Mon, Feb 1, 2016 at 10:16 AM, Stas Sergeev wrote: >> 01.02.2016 21:04, Oleg Nesterov пишет: >>> Yes, and SS_FORCE means "I know what I do", looks very simple. >> But to me its not because I don't know what to do with >> uc_stack after SS_FORCE is applied. >> >>> I won't argue, but to me it would be better to keep this EPERM if !force. >>> Just because we should avoid the incompatible changes if possible. >> Ok then. Lets implement SS_FORCE. >> What semantic should it have wrt uc_stack? >> >> sigaltstack(SS_DISABLE | SS_FORCE); >> swapcontext(); >> sigaltstack(set up new_sas); >> rt_sigreturn(); >> >> What's at the end? Do we want a surprise for the user >> that he's new_sas got ignored? > More detail please. What context are you returning to with > rt_sigreturn? What's in uc_stack? Whatever was saved there by save_altstack_ex() I guess. Which is the sas params on signal entry. And I am returning to the interrupted user context. I am using SA_SIGINFO with sigaction(). This is actually what I was asking you already yeaterday. I don't think SS_FORCE can play nicely with uc_stack and you haven't clarified that part, so lets try again. > Presumably we should continue to honor uc_stack in rt_sigreturn. In this case, the above sigaltstack(set up new_sas) just gets ignored. Are we allright with that? If so, I can code up the patch. Whatever. :) > I'm > less clear on whether we should have an implicit SS_FORCE when > restoring uc_stack. This is obscure and is likely outside of the scope of the problem at hands. > I'm also not clear on why uc_stack exists in the > first place. > > If I were designing this from scratch, I'd have signal delivery for an > SA_ONSTACK signal save away the altstack information and clear it so > that nested signals work without checking sp during signal delivery. How would you then evaluate oss->ss_flags?