Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp277376rwi; Wed, 19 Oct 2022 21:26:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sKaJVzgkLBjSkNOQj9Js7E5oplbfC00YolNzkH7L5U/4sfV3o423Lx/pGF8g9JFcAt3V8 X-Received: by 2002:a17:90b:1a88:b0:20d:8df0:ac64 with SMTP id ng8-20020a17090b1a8800b0020d8df0ac64mr13557310pjb.140.1666239992662; Wed, 19 Oct 2022 21:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666239992; cv=none; d=google.com; s=arc-20160816; b=rQKhEXJlX2RweOOhGSG9m/Or0fu2J3cX8INQ7YC2ARgcFOfHyDE31v3A7tELl6vwBT 14JRyjQY7LO3Hb5EeOhIbLQoIuXsXBXsP7K5LXuHKUFTeubYpBTiPw5jZWXlTsRp4B7V U4OlPz4rzREfn+kcBWWmYXUBa+KezkbZw2VwzSsWupj1hcH9KhRgRAX0bA+G3P804FHh I89FnoCDc8Uk4FWWyx10LKUCZTke0VJYDfd/3l6mnRdhLiCouqS6g/BmkQWxvYmgfemE JyjLT5QZ24Cy8G7Cloi6FK5UBHMOwxgN/T7E1FzNFEUEYSlo/P83J9krzp52WSQNKKhZ YedA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qadNFZ7XWekAb/DyZLHG/LNLJMySf8HJL6Ybo4oyuUY=; b=wckgjKiXnJWi8C8KeCVF5C9bagAYSj86rDTcSUzVHB6E/p+AruT+Cz7KhQ3oMMd5Tn zcgXlDU4CHCo1tqrK2DoDUu/tAcP4Xb7NIhFuZegKsaYHczvN49X2q2ztI+Kl2zxITDb I9C3V/stWxRTfM+uaypK2YFpWGNZ3iYUk/O23WAlPNrcep8AWs46K3rUITS2OmfQSCcf WbV02cdBxxLx9Kgew3rVS9Yj/40Ofkp8mcgxCRTLQ/DoXYeg4PAYeBtii1TnUJ8XzgEH 0J5SG3nyfvpwM06lO7d1jX3Fy8sfpZTV+DAkpNk5CxOx++x8l2shknRRBoGOYwdnLj+X s0OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=UYPPWo07; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a6384c7000000b0045fd1d35d83si20106238pgd.795.2022.10.19.21.26.12; Wed, 19 Oct 2022 21:26:32 -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; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=UYPPWo07; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbiJTDMK (ORCPT + 99 others); Wed, 19 Oct 2022 23:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbiJTDMG (ORCPT ); Wed, 19 Oct 2022 23:12:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AA0113FDF0; Wed, 19 Oct 2022 20:12:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0DBF7619D7; Thu, 20 Oct 2022 03:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4B04C433D7; Thu, 20 Oct 2022 03:12:02 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="UYPPWo07" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1666235520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qadNFZ7XWekAb/DyZLHG/LNLJMySf8HJL6Ybo4oyuUY=; b=UYPPWo07B4JIquDZmfeMceCq/7TtxQ6+A1anGpsJuDWQP7mLbxXUNzp45Z3SSOvKGJKF0i F9bsBR7UsgpNykbqeqOjU4d28CF26tefLa9feTLt/xP+Lh8M/17pyrKrphSFmzXqMpbpLG aYqFfA8ad216c82Dm64hXKfYGEMBE5I= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 7c50f5bb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 20 Oct 2022 03:12:00 +0000 (UTC) Received: by mail-vk1-f179.google.com with SMTP id o28so9184345vkn.11; Wed, 19 Oct 2022 20:11:59 -0700 (PDT) X-Gm-Message-State: ACrzQf0h0/Tadi32Ztg+REpu9BJ44rRFNpy+pzIXkB+R3qTCiJFMVjaX PRHyM7G2WIshF/XJ9h1OKAFdNwDrza35QTsqtBw= X-Received: by 2002:a1f:e0c4:0:b0:3ab:191d:e135 with SMTP id x187-20020a1fe0c4000000b003ab191de135mr5171014vkg.41.1666235518593; Wed, 19 Oct 2022 20:11:58 -0700 (PDT) MIME-Version: 1.0 References: <20221019162648.3557490-1-Jason@zx2c4.com> <20221019165455.GL25951@gate.crashing.org> <20221019174345.GM25951@gate.crashing.org> <202210191209.919149F4@keescook> In-Reply-To: From: "Jason A. Donenfeld" Date: Wed, 19 Oct 2022 21:11:46 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: treat char as always signed To: Linus Torvalds Cc: Kees Cook , Nick Desaulniers , Segher Boessenkool , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-toolchains@vger.kernel.org, Masahiro Yamada , Andrew Morton , Andy Shevchenko , Greg Kroah-Hartman , Sultan Alsawaf Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 6:11 PM Linus Torvalds wrote: > > On Wed, Oct 19, 2022 at 1:35 PM Jason A. Donenfeld wrote: > > > > I wish folks would use `u8 *` when they mean "byte array". > > Together with '-funsigned-char', we could typedef 'u8' to just 'char' > (just for __KERNEL__ code, though!), and then we really could just use > 'strlen()' and friends on said kind of arrays without any warnings. > > But we do have a *lot* of 'unsigned char' users, so it would be a huge > amount of churn to do this kind of thing. I think, though, there's an argument to be made that every use of `unsigned char` is much better off as a `u8`. We don't have any C23 fancy unicode strings. As far as I can tell, the only usage of `unsigned char` ought to be "treat this as a byte array", and that's what u8 is for. Yea, that'd be churn. But technically, it wouldn't really be difficult churn: If naive-sed mangles that, I'm sure Coccinelle would be up to the task. If you think that's a wise direction, I can play with it and see how miserable it is to do. (As a sidebar, Sultan and I were discussing today... I find the radical extension of this idea to its logical end somewhat attractive: exclusively using u64, s64, u32, s32, u16, s16, u8, s8, uword (native size), sword (native size), char (string/character). It'd hardly look like C any more, though, and the very mention of the idea is probably triggering for some. So I'm not actually suggesting we do that in earnest. But there is some appeal.) Jason