Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1405187rwi; Wed, 19 Oct 2022 10:09:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RLEdBKosPIQTGOSbPuz/X/R0hP4RTN5brSAr3tRJnZjrX+o9WtEyGARzS6UtEDO9QGevl X-Received: by 2002:a63:d118:0:b0:43c:1440:6486 with SMTP id k24-20020a63d118000000b0043c14406486mr8204924pgg.92.1666199367054; Wed, 19 Oct 2022 10:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666199367; cv=none; d=google.com; s=arc-20160816; b=fWPghb+4/EmT6SUFzP3J4LWmR7VWs6gGD3NY51FCL/GFYjZKIeOwAnivuFoWemTD3J RMr66Ljh4cir0GS7PfOEsfnNknZQqdLSihj2gRZSxvE+RUpc2aYy/BXITduw6g1IggFD oDCbWiloGIZcuaEF7PHyYSsR1ZsXZQgitqHpfpDiIuurCc6o8jWUNDopBUNYHTyCIsdj C2RI+LRlfy1++v/ulGLCHG0suKIDT2fq8pmKL37AHt1PPrB5jNgPd6iDB6xOKg2Yu4hT gnMyUyHQqMc0C5c97ZOx1FTPPmmeaHkT6TRV9Xs8e5kTTcMpWlWuZKP4gvFoLzhgGkdY 0uiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=dsybMPBze7FzZyWNKgeyygoa9AqPGj5vReL4F4ezxCk=; b=kf16g9qlMhmRczLfYe+iQTDLeGXnkk75hc1lSTYU5fUzNIT/gmc/ELhn4w5kRFmWQc TbGo3BacImBcqkcXgKjKBulfbhiZkTSvTjB8waKc3h+9d1/EN8rSpZA2RqG0/ugWa1b+ dgESuk6WDp2WgqxUQZ3xGCaA+Tcaw+8mPKWhxfPzBe3DiN+zYB2bhtEXIi32AW4eZW5m LQuRdGQcvWJs0H+a6SA6NYHzr1SQHQ4rAOhYHcMvqyxvq6nqDySNn7sh740OGB1dOxO7 3o2uSJ1ouxsT47ALneyplipCaJwPNOhZOl/e6LhxpB9oyoAGTrGIr0x7TTok+WkG9eC7 C8bQ== 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 p12-20020a170902ebcc00b0017f57787a5dsi18332846plg.223.2022.10.19.10.09.12; Wed, 19 Oct 2022 10:09:27 -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 S231425AbiJSQ7L (ORCPT + 99 others); Wed, 19 Oct 2022 12:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbiJSQ6s (ORCPT ); Wed, 19 Oct 2022 12:58:48 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A3FE1D20D8; Wed, 19 Oct 2022 09:58:35 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 29JGsuT6001975; Wed, 19 Oct 2022 11:54:56 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 29JGstV1001974; Wed, 19 Oct 2022 11:54:55 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 19 Oct 2022 11:54:55 -0500 From: Segher Boessenkool To: "Jason A. Donenfeld" Cc: 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 , Linus Torvalds , Andy Shevchenko , Greg Kroah-Hartman Subject: Re: [PATCH] kbuild: treat char as always signed Message-ID: <20221019165455.GL25951@gate.crashing.org> References: <20221019162648.3557490-1-Jason@zx2c4.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221019162648.3557490-1-Jason@zx2c4.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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 Wed, Oct 19, 2022 at 10:26:48AM -0600, Jason A. Donenfeld wrote: > Recently, some compile-time checking I added to the clamp_t family of > functions triggered a build error when a poorly written driver was > compiled on ARM, because the driver assumed that the naked `char` type > is signed, but ARM treats it as unsigned, and the C standard says it's > architecture-dependent. > So let's just eliminate this particular variety of heisensigned bugs > entirely. Set `-fsigned-char` globally, so that gcc makes the type > signed on all architectures. This is an ABI change. It is also hugely detrimental to generated code quality on architectures that make the saner choice (that is, have most instructions zero-extend byte quantities). Instead, don't actively disable the compiler warnings that catch such cases? So start with removing footguns like # disable pointer signed / unsigned warnings in gcc 4.0 KBUILD_CFLAGS += -Wno-pointer-sign Segher