Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5867196rwi; Sun, 23 Oct 2022 13:34:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kxzyx1XYaGLrbk+9LGtJpJKugoMfHublo4tiWzHjp2FVeZrldaPnatNxP6ejC/X4ql5/w X-Received: by 2002:a17:907:2bda:b0:78d:9144:fb6d with SMTP id gv26-20020a1709072bda00b0078d9144fb6dmr24795217ejc.238.1666557268917; Sun, 23 Oct 2022 13:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666557268; cv=none; d=google.com; s=arc-20160816; b=RT7midUBlaXp+WztM0PVz0Q0b07CG2QV/5k7B29vjXJZfwbV/TWM6dgqzaYJep2wLy Ys4n8GC0VYk9nq9iZO5TU8PmjQwmb48YFw5qr6Du8emTBviB+iO2vXeXP1hEsO9sa/dg O9EeCWT8QiZ1U/B4x5Zpc/NDWBLMLB4UMHQZouwr/SxlkYWOChlVaA9CSAsXdbMY5btM pSBTFa1rvQBTI5whfY9KxG8A0NAGAS9m+5RjyyPOONjxhN2ehkRd1Toq+RlNcRu10M6O PgWflm30OHsdhPDWWp7aFrfRLpIBc3FEcm5r3oevdJFDUPdmTGSWmKTPVpr1t2pGD4vB fFEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6YQZyktyxVPOmSeL50ehStVZLVFSSu2K+qmFpI0c4BM=; b=xodSt+6i7HlnGpfyMy4ljFJOrMdz31uDnn2Gdp0yzoQI3nUpXNFKkLNFvZ3HjPoSIU 88xDN7HeXBh3drQuHJHmPl0wGAcc7IeU5xbDio2RmgJXhE3urFPV1oUrezymS8/e0/rn pZjiNLlDA+8lKeJwmFaXD9ywj64EK3lTTh8i9qPY8Z+6XeTT4cCS0OmW1vB9TlFYJMHf Fo46gNdvRrJDoAPVTS13SwkQrrfX4HVLHzr8asLOMNZa9WVKLc0xgMq/KzeCGwLIkN8z 1tHshBSZdsOxnkppPvcMUxxX9NFnR6DmSWHk7IsJyZKTj7s4tF0F13sYerAggBwG0BMX 4scw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a170906500800b0078d3b940ec5si23011368ejj.373.2022.10.23.13.34.03; Sun, 23 Oct 2022 13:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbiJWUZB convert rfc822-to-8bit (ORCPT + 99 others); Sun, 23 Oct 2022 16:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbiJWUYz (ORCPT ); Sun, 23 Oct 2022 16:24:55 -0400 Received: from mx07-006a4e02.pphosted.com (mx07-006a4e02.pphosted.com [143.55.146.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E4813CD4; Sun, 23 Oct 2022 13:24:44 -0700 (PDT) Received: from pps.filterd (m0316692.ppops.net [127.0.0.1]) by m0316692.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 29NKKQJ6017297; Sun, 23 Oct 2022 22:24:06 +0200 Received: from mta-out01.sim.rediris.es (mta-out01.sim.rediris.es [130.206.24.43]) by m0316692.ppops.net (PPS) with ESMTPS id 3kcu9mc2sc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 22:24:06 +0200 Received: from mta-out01.sim.rediris.es (localhost.localdomain [127.0.0.1]) by mta-out01.sim.rediris.es (Postfix) with ESMTPS id 26DDA3000047; Sun, 23 Oct 2022 22:24:05 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mta-out01.sim.rediris.es (Postfix) with ESMTP id E22013197C11; Sun, 23 Oct 2022 22:24:04 +0200 (CEST) X-Amavis-Modified: Mail body modified (using disclaimer) - mta-out01.sim.rediris.es Received: from mta-out01.sim.rediris.es ([127.0.0.1]) by localhost (mta-out01.sim.rediris.es [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AvB5T1Imovv1; Sun, 23 Oct 2022 22:24:04 +0200 (CEST) Received: from lt-gp.iram.es (haproxy02.sim.rediris.es [130.206.24.70]) by mta-out01.sim.rediris.es (Postfix) with ESMTPA id B07C23000047; Sun, 23 Oct 2022 22:24:01 +0200 (CEST) Date: Sun, 23 Oct 2022 22:23:56 +0200 From: Gabriel Paubert To: Linus Torvalds Cc: Segher Boessenkool , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-toolchains@vger.kernel.org, Masahiro Yamada , Kees Cook , Andrew Morton , Andy Shevchenko , Greg Kroah-Hartman Subject: Re: [PATCH] kbuild: treat char as always signed Message-ID: References: <20221019162648.3557490-1-Jason@zx2c4.com> <20221019165455.GL25951@gate.crashing.org> <20221019174345.GM25951@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: 8BIT X-Proofpoint-ORIG-GUID: zgBEguqV2sx207ySGJtcCtxIxSPFqKi5 X-Proofpoint-GUID: zgBEguqV2sx207ySGJtcCtxIxSPFqKi5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-21_04,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbounddefault_notspam policy=outbounddefault score=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 suspectscore=0 impostorscore=0 bulkscore=0 mlxlogscore=769 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210230130 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,PDS_RDNS_DYNAMIC_FP, RCVD_IN_DNSWL_NONE,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 22, 2022 at 11:16:33AM -0700, Linus Torvalds wrote: > On Fri, Oct 21, 2022 at 11:06 PM Gabriel Paubert wrote: > > > > Ok, I?ve just tried it, except that I had something slightly different in > > mind, but perhaps should have been clearer in my first post. > > > > I have change your code to the following: > > I actually tested that, but using a slightly different version, and my > non-union test case ended up like > > size_t strlen(const char *p) > { > return __builtin_strlen(p); > } > > and then gcc actually complains about > > warning: infinite recursion detected > > and I (incorrectly) thought this was unworkable. But your version > seems to work fine. Incidentally, it also gives exactly the same code with -ffreestanding. > > So yeah, for the kernel I think we could do something like this. It's > ugly, but it gets rid of the crazy warning. Not as ugly as casts IMO, and it's localized in a few header files. However, it does not solve the problem of assigning a constant string to an u8 *; I've no idea on how to fix that. > > Practically speaking this might be a bit painful, because we've got > several different variations of this all due to all the things like > our debugging versions (see for example), so > some of our code is this crazy jungle of "with this config, use this > wrapper". I've just had a look at that code, and I don't want to touch it with a 10 foot pole. If someone else to get his hands dirty... Gabriel > > But if somebody wants to deal with the '-Wpointer-sign' warnings, > there does seem to be a way out. Maybe with another set of helper > macros, creating those odd __transparent_union__ wrappers might even > end up reasonable. > > It's not like we don't have crazy macros for function wrappers > elsewhere (the SYSCALL macros come to mind - shudder). The macros > themselves may be a nasty horror, but when done right the _use_ point > of said macros can be nice and clean. > > Linus