From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EAFFC433E2 for ; Tue, 8 Sep 2020 19:50:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F159F20658 for ; Tue, 8 Sep 2020 19:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730770AbgIHTus (ORCPT ); Tue, 8 Sep 2020 15:50:48 -0400 Received: from foss.arm.com ([217.140.110.172]:56350 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730802AbgIHPuk (ORCPT ); Tue, 8 Sep 2020 11:50:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A4D2E1692; Tue, 8 Sep 2020 08:12:27 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C50A03F73C; Tue, 8 Sep 2020 08:12:25 -0700 (PDT) Date: Tue, 8 Sep 2020 16:12:23 +0100 From: Dave Martin To: Peter Collingbourne Cc: Catalin Marinas , Evgenii Stepanov , Kostya Serebryany , Vincenzo Frascino , Will Deacon , Oleg Nesterov , "Eric W. Biederman" , "James E.J. Bottomley" , linux-parisc@vger.kernel.org, Andrey Konovalov , Kevin Brodsky , David Spickett , Linux ARM , Richard Henderson Subject: Re: [PATCH v10 2/7] arch: move SA_* definitions to generic headers Message-ID: <20200908151223.GS6642@arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Fri, Aug 21, 2020 at 10:10:12PM -0700, Peter Collingbourne wrote: > Most architectures with the exception of alpha, mips, parisc and > sparc use the same values for these flags. Move their definitions into > asm-generic/signal-defs.h and allow the architectures with non-standard > values to override them. Also, document the non-standard flag values > in order to make it easier to add new generic flags in the future. > > Signed-off-by: Peter Collingbourne While this looks reasonable, I've just realised that you strip the "U" from some arches' definitions here. So, on powerpc and x86, this changes the type of flags other than SA_RESETHAND from unsigned int to int. While I can't see this breaking any sensible use of these flags, there's a chance that there is software relying on this distinction by accident. I wonder whether it's worth doing something like #ifdef ARCH_WANT_STRICTLY_UNSIGNED_SA_FLAGS #define __SA_FLAG_VAL(x) x ## U #else #define __SA_FLAG_VAL(x) x #endif #ifndef SA_NOCLDSTOP #define SA_NOCLDSTOP __SA_FLAG_VAL(0x00000001) #endif /* ... */ Mind you, the historical situation also has issues, e.g. because sa_flags in struct sigaction is an int, assigning struct sigaction sa; sa.sa_flags = SA_RESETHAND; implies an overflow and so isn't portably safe (at least in theory). I guess we are getting away with it today. Preserving the situation by keeping the "U"s where appropriate would at least avoid making the situation worse. [...] Cheers ---Dave