Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751591AbcCFU1q (ORCPT ); Sun, 6 Mar 2016 15:27:46 -0500 Received: from smtp48.i.mail.ru ([94.100.177.108]:59963 "EHLO smtp48.i.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbcCFU1h (ORCPT ); Sun, 6 Mar 2016 15:27:37 -0500 Subject: Re: [PATCH v4 0/2] make sigaltstack() compatible with swapcontext() To: Szabolcs Nagy References: <1456781345-8243-1-git-send-email-stsp@list.ru> <20160306200207.GT29662@port70.net> Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andy Lutomirski , Oleg Nesterov , Shuah Khan From: Stas Sergeev Message-ID: <56DC92AE.3070707@list.ru> Date: Sun, 6 Mar 2016 23:27:26 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160306200207.GT29662@port70.net> 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 Content-Length: 1322 Lines: 30 06.03.2016 23:02, Szabolcs Nagy пишет: > * Stas Sergeev [2016-03-01 00:29:03 +0300]: >> The following patches make it possible to use swapcontext() >> in a sighandler that works on sigaltstack. > i don't think that's possible, the (obsolete) userspace > *context functions cannot operate on kernel provided > ucontext_t structs, It doesn't have to. It does the normal getcontext()/swapcontext() sequences, as if it would be switching from any casual code place. Kernel-provided context structs are completely irrelevant. For more details please see the test-case I posted in that patch series. It shows what can be done and how. > so they are not usable in signal > handlers. Please note the fact that swapcontext() also replaces the signal mask as part of the context switching. This is a very strong hint that it was intended to work with signal handlers. And in fact it perfectly does. What I want is only to make it friendly to sigaltstack. I am not making it friendly to signal handlers in general, because it already is. > at least not on most target archs. > > so i don't understand how the tests can work portably. If you apply my patch series, you can immediately test it on any arch you want, thanks to the test-case my patch adds to the kernel. Please let me know on what arch it fails.