From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751445AbdBDRzU (ORCPT ); Sat, 4 Feb 2017 12:55:20 -0500 Received: from smtp44.i.mail.ru ([94.100.177.104]:54156 "EHLO smtp44.i.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbdBDRzT (ORCPT ); Sat, 4 Feb 2017 12:55:19 -0500 X-Greylist: delayed 20807 seconds by postgrey-1.27 at vger.kernel.org; Sat, 04 Feb 2017 12:55:19 EST Subject: Re: [PATCH] sigaltstack: support SS_AUTODISARM for CONFIG_COMPAT To: Andy Lutomirski References: <20170204120711.15935-1-stsp@list.ru> Cc: Stas Sergeev , Shuah Khan , Andrew Morton , Jiri Kosina , Al Viro , Stephen Bates , Milosz Tanski , Andy Lutomirski , Ingo Molnar , "Peter Zijlstra (Intel)" , Helge Deller , Wang Xiaoqiang , Dave Hansen , "linux-kernel@vger.kernel.org" From: Stas Sergeev Message-ID: Date: Sat, 4 Feb 2017 20:54:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: smtp44.i.mail.ru; auth=pass smtp.auth=stsp@list.ru smtp.mailfrom=stsp@list.ru X-E1FCDC63: 8DF708DCCFA3232C692FBC5436FEFBBC0E54C3044D106D88 X-E1FCDC64: 96F8C2D3595EA0FE27E5B045D58F33CC43022FC8CBC44B446456D30E3B8EF64B X-Mailru-Sender: CD12F6D16A91A65928D288116902403BB9C2DBED09C8DFED6E45F75D744D5E3F307CDEDF469361BC51CE0648C9E8651D X-Mras: OK Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 04.02.2017 20:32, Andy Lutomirski пишет: > On Sat, Feb 4, 2017 at 4:07 AM, Stas Sergeev wrote: >> Currently SS_AUTODISARM is not supported in compatibility >> mode, but does not return -EINVAL either. This makes dosemu >> built with -m32 on x86_64 to crash. Also the kernel's sigaltstack >> selftest fails if compiled with -m32. >> >> This patch adds the needed support. It also improves the >> selftest output a little (%i changed to %x for bitmasks). >> >> Signed-off-by: Stas Sergeev >> > Spurious newline. Is this a problem? :) > Also, should this be cc:stable? It doesn't match the stable submission criteries AFAICS. Can we declare it "obviously correct" and the problem it fixes "critical"? If so, I'll need to strip the %i -> %x change from it as it doesn't pass the stable submission guidelines. >> diff --git a/include/linux/compat.h b/include/linux/compat.h >> index 6360939..d8535a4 100644 >> --- a/include/linux/compat.h >> +++ b/include/linux/compat.h >> @@ -711,8 +711,10 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); >> compat_stack_t __user *__uss = uss; \ >> struct task_struct *t = current; \ >> put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \ >> - put_user_ex(sas_ss_flags(sp), &__uss->ss_flags); \ >> + put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \ > Should the sas_ss_flags() helper be deleted, perhaps? This code seems > a bit odd -- it no longer does the on_sig_stack(sp) check.. (It > matches the non-compat code.) sas_ss_flags() is still used in sigaltstack() code and in signal delivery code, so why do you think it should be removed? It is needed to return the correct status via sigaltstack() and for deciding whether to switch stacks. But saving and restoring to/from uc_stack must be done with raw flags. I don't think we need to check on_sig_stack() when saving to uc_stack, or do we?