Received: by 10.223.164.221 with SMTP id h29csp2526360wrb; Mon, 30 Oct 2017 05:35:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QpeRq16axiwIWy7D561xnNU/BqmpiAAKAvIokKaZf+fDuLtdL5m8x2ZTFWs3w0q4K/IjtC X-Received: by 10.159.218.142 with SMTP id w14mr7501895plp.310.1509366931717; Mon, 30 Oct 2017 05:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509366931; cv=none; d=google.com; s=arc-20160816; b=FUaWEeJJ1jk+hW+ktG1jdJZGhc5wU/+J1q4z14MGTJtbck8DeoJ3U101QLWLuY1OMT FFDHmw7HR0AZj9OQLZVrOzmQ7dktuh4FaHsk6BPaFPqIjXz2JlAE4Av19hSjE7KopY5k Y3ib+P7zPh8JgBz/yLg6RD8R9adSLl7nKuGuBrtffOWYb6cTDwYOZ2rqgxyHUfA6v/KM sIA/+05N3AEr/3qaEeTT3z0CxRHHfo+TDhZjtGhYDaErBd/nOUX4FtL0jf4QDoLbXgmd njZBeIvxFaAl2xMjzqOmJCZM3ZPOc1Noyw01DW2IbopHiWK39h5TblXCKGd8jewHV41+ cJYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc:dkim-signature :arc-authentication-results; bh=BZW9GXoPSY/n5YCZFtNoq8rX5Mqmuww6jiddceamk8Y=; b=j1DKm7lvS8tD8zBoxw5qLSlUHX5pqRcRTLu1EUVe/a9cJu1tv9FSbSbRopnJXVj0Vm IbG9kwfk1/bKYx5UBURP8vo48Lns+gl1xhdxqve1+M2GRlXVhJ//CLF6U4I6EDcnAMPE 6mMburToRjJ7ahUPEgumIU9iH2h0IpsIrMlaqDoIzmhhy1hpZ2dKiB9hNRStOdddJdL6 xAPEFHh4Skxmf/gNqstqBpeN7TQ8TcS7QJU9greSN17zIC62e+FznRGnMtnC6p3s6IXP raYXnTUGq959+TH9nx6LNkRKX8Oy7ykq/6B8ymuTg6WEhYjgE8BLez/S05AA111OgN7L tmjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E1OWbUU+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w28si10028148pgm.49.2017.10.30.05.35.18; Mon, 30 Oct 2017 05:35:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E1OWbUU+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752470AbdJ3Kuo (ORCPT + 99 others); Mon, 30 Oct 2017 06:50:44 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:43838 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751981AbdJ3Kum (ORCPT ); Mon, 30 Oct 2017 06:50:42 -0400 Received: by mail-wr0-f180.google.com with SMTP id w105so12083723wrc.0; Mon, 30 Oct 2017 03:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=cc:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BZW9GXoPSY/n5YCZFtNoq8rX5Mqmuww6jiddceamk8Y=; b=E1OWbUU+aJJBdimMFKjDYNYOtdCS/ESNioyPDQNrhytMYFxrcKY4zm+GZdTnrUTJd4 FwNj1QHEpJXo+Ax7G+Pi6RC6o2iOEaoDVFw7y3Q6bLwY7w93BIz6XQNOVffEYr92Xen4 yiPRbZTU+HNse/pj2zErSh0A78G8MN2k7iGTGIVP2yJG2efadHfSuK4YrZyAZl4IMBCC HCxcUp/sOuFpgH0f8mBB/JQWOyk/kesvkel5hVONIlCigUvddZ38QptXODVPv2/SPWlZ eGqRgoIdAhMO1jMF4PKbbLUfxbEw5Mm42WJmPMCAGwb5oHeNrkUxOhbgiIFYBGMxKCED a+Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BZW9GXoPSY/n5YCZFtNoq8rX5Mqmuww6jiddceamk8Y=; b=bEKBMH9F9sz/wvfs93ylV9tfCNjsJGc5eYikoopeegx4rF5Z5rIIhdwfHXreb9rkXQ j81AkGhNHTTwAC3TWgvDFTMJ3hVk8ihQOEnrprdIIFHrtR8/akfX8uRzko616UwpR3pj YP+PvHb0UPoMPS8B4Wh1teaARaqQpjtZPyqMbb4vJuI0aqZ/DojIEbXnRxTfAZuoQRzL G2zYeavSUR9rrhxXwrs/FJ1yOZw9N7Zd1WQS3php4E2uPtJMA7+sHJyZOjfmCvanS8y7 fcpDZwqZtbpJp3vt8L+V6ySjgfSCicjNZCZVna34woOuZarDILIGYNapKxlQllxyge/P N/SQ== X-Gm-Message-State: AMCzsaUPnhzhpWrENeogOQqbVL3lxlh33Dn1ZSIViw9xvLMLIDdwjfiM PXGdRnQF8gmQdHQqN2YvOexjtc9V X-Received: by 10.223.147.135 with SMTP id 7mr7592979wrp.237.1509360641031; Mon, 30 Oct 2017 03:50:41 -0700 (PDT) Received: from [192.168.234.154] (mail2.jambit.com. [213.131.239.194]) by smtp.gmail.com with ESMTPSA id x23sm2990583wmc.31.2017.10.30.03.50.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 03:50:39 -0700 (PDT) Cc: mtk.manpages@gmail.com, Stas Sergeev , linux-man , Andy Lutomirski , Oleg Nesterov , lkml Subject: Re: Documenting sigaltstack SS_AUTODISRM To: wharms@bfs.de References: <08467ae1-7187-3b2a-9a78-8af0c10bf816@list.ru> <3907bc2a-0645-8d93-6ee5-3f99874e7022@gmail.com> <32d95303-5839-9279-a1d3-a06f34e3484e@list.ru> <50de8f3b-8a1e-df50-b5dd-d1b74cb77fad@list.ru> <026308b5-4e92-4439-1eb2-82b67584d548@gmail.com> <3a4f9f3e-fc33-cf98-2322-27087664813f@list.ru> <59F6FD39.40502@bfs.de> From: "Michael Kerrisk (man-pages)" Message-ID: Date: Mon, 30 Oct 2017 11:50:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <59F6FD39.40502@bfs.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Walter, On 10/30/2017 11:21 AM, walter harms wrote: > > > Am 30.10.2017 11:04, schrieb Michael Kerrisk (man-pages): >> [So, things fell on the floor, a while back.] >> >> On 05/25/2017 11:17 AM, Stas Sergeev wrote: >>> 24.05.2017 14:09, Michael Kerrisk (man-pages) пишет: >>>> One could do this I suppose, but I read POSIX differently from >>>> you and, more importantly, SS_ONSTACK breaks portability on >>>> numerous other systems and is a no-op on Linux. So, the Linux man >>>> page really should warn against its use in the strongest terms. >>> So how about instead of the strongest terms towards >>> the code's author, just explain that SS_ONSTACK is a >>> bit-value on some/many OSes, and as such, 0 is a >>> valid value to enable sas on them, plus all the other >>> values would give EINVAL? >>> No strongest terms will help w/o an explanation, >>> because people will keep looking for something that >>> suits as a missing SS_ENABLE. >> >> Fair enough. I've removed the statement in the manual page >> about "confusion". By now the page says: >> >> BUGS >> In the lead up to the release of the Linux 2.4 kernel, a change >> was made to allow sigaltstack() to accept SS_ONSTACK in >> ss.ss_flags, which results in behavior that is the same as when >> ss_flags is 0 (i.e., the inclusion of SS_ONSTACK in ss.ss_flags is >> a no-op). On other implementations, and according to POSIX.1, > > i am confused, i understand that: > ss.ss_sp = malloc(SIGSTKSZ); > > ss.ss_size = SIGSTKSZ; > ss.ss_flags = 0; > if (sigaltstack(&ss, NULL) == -1) > > is equivalent to: > ss.ss_sp = malloc(SIGSTKSZ); > > ss.ss_size = SIGSTKSZ; > ss.ss_flags = SS_ONSTACK ; > if (sigaltstack(&ss, NULL) == -1) > > but also to > ss.ss_sp = malloc(SIGSTKSZ); > > ss.ss_size = SIGSTKSZ; > ss.ss_flags = SS_ONSTACK | SOMETHING_FLAG ; > if (sigaltstack(&ss, NULL) == -1) > > so the use of SS_ONSTACK would result in ss.ss_flags = 0 no matter what. > OR > SS_ONSTACK is a no-op in Linux I see what you mean. The point is back then that SS_ONSTACK was the only flag that could (on Linux) be specified in ss.ss_flags, so that "SS_ONSTACK | SOMETHING_FLAG" was a nonexistent case. These days, it's possible to specify the new SS_AUTODISARM flag in ss.ss_flags, which I think is why you are doubtful about the new page text. How about this, as a tightened-up version: BUGS In Linux 2.2 and earlier, the only flag that could be specified in ss.sa_flags was SS_DISABLE. In the lead up to the release of the Linux 2.4 kernel, a change was made to allow sigaltstack() to allow ss.ss_flags==SS_ONSTACK with the same meaning as ss.ss_flags==0 (i.e., the inclusion of SS_ONSTACK in ss.ss_flags is a no-op). On other implementations, and according to POSIX.1, SS_ONSTACK appears only as a reported flag in old_ss.ss_flags. On Linux, there is no need ever to specify SS_ONSTACK in ss.ss_flags, and indeed doing so should be avoided on portability grounds: var‐ ious other systems give an error if SS_ONSTACK is specified in ss.ss_flags. ? Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ From 1582683791043680685@xxx Mon Oct 30 12:01:22 +0000 2017 X-GM-THRID: 1582678540934340950 X-Gmail-Labels: Inbox,Category Forums