Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp9244865rwi; Tue, 25 Oct 2022 17:25:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wtFJdugL72oc7vA/sshzPecik0KizxnM4yA0SmpZqkKWABubVLR9o0egYY+EOdqyKPl63 X-Received: by 2002:a17:907:78b:b0:741:3d29:33d2 with SMTP id xd11-20020a170907078b00b007413d2933d2mr36340154ejb.103.1666743907135; Tue, 25 Oct 2022 17:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666743907; cv=none; d=google.com; s=arc-20160816; b=Gbffnmxe103haJjAjLpN9S0ckl6hNyH5MsFZaSksLqhSx+HGKpeKGZiLI8EUWF831P 55fB+NnRYSn/laGRUKPUI2VAP9pFutAL9dBaSv3DtJqP3qUs1AAI/+fSUfphk9BqngGs UM/aGPfluXe6rJBLWSq9cd0IL0ZO9HKyJWkjfmtDnlLhlNUKRl0KruL//l7fdtaOy3sP fkq1k4L5oZUBmowINOv6gAWY0yFHaHXcvL0yHIsb+IzezYKkdHyQ9sGRbVXrHaVgIxwS V7dpvtDiBLHIt4EhNMS/UIbZHBBLiphR5XtkdjszUk9xRJVrfY7k30bp0WFEtixHubti Iudw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IkwAfVtYTtU51oc7/jn0Fs/YPN6o4wcDABPb9JF67Co=; b=n/JGoBW0GkCjcdJkap5lwxwJTPVs79vJJa+RjJ/0q85ElDyiuaJlrbHeiOFPKvEsYy 6SI2FOf4EF6MapfQ0n5sTOOuzbk7O3mnc/HXrqmgFYMnWDm7COa6ILhhANgnfVsLj5Jm pZvJTKh/r3oiK0lgEvo0bB3u3wNIpSTefnIFjUAqK/TR596kv3fvb4VvU6TYL8Rw/+sN U3QOACgmQvLNHH7o0YrUbZx5vzwtXYjRhSVJ093PjkTWLTXOYazew6ujZqxfQkm1b2mD huta4ZYcgtY03vGaLye57Z8Q12gqIfg9wwb/5tIiIyEGB6oZ8AsaqW3mu5u14iHRvR0A 3bSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=IRMU2CLv; 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 o15-20020a170906974f00b0079e1916c11asi853081ejy.703.2022.10.25.17.24.41; Tue, 25 Oct 2022 17:25:07 -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=IRMU2CLv; 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 S233089AbiJZAEu (ORCPT + 99 others); Tue, 25 Oct 2022 20:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbiJZAEn (ORCPT ); Tue, 25 Oct 2022 20:04:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848221DA41; Tue, 25 Oct 2022 17:04:40 -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 5B3A461BBE; Wed, 26 Oct 2022 00:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 458A7C433D6; Wed, 26 Oct 2022 00:04:38 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="IRMU2CLv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1666742676; 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=IkwAfVtYTtU51oc7/jn0Fs/YPN6o4wcDABPb9JF67Co=; b=IRMU2CLvIifkL42MsPhI3sulQbEzr9U6+3fTzexuHGDEHqDdCJoRJwnwnjVfq7kOB0P29/ DdnlPZAq8bFUyY7kzXADuQeAVqE2/bIzAWRbc4tqLPkYqrlX6bvTUBGGbatNvgoZNC+stY P429xx95hvHaPve3E+kljj0BMdcS6wg= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id fd4b7e5d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 26 Oct 2022 00:04:35 +0000 (UTC) Date: Wed, 26 Oct 2022 02:04:30 +0200 From: "Jason A. Donenfeld" To: Kees Cook Cc: Gabriel Paubert , Linus Torvalds , 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 Subject: Re: [PATCH] kbuild: treat char as always signed Message-ID: References: <20221019165455.GL25951@gate.crashing.org> <20221019174345.GM25951@gate.crashing.org> <202210251555.88933A57F@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202210251555.88933A57F@keescook> 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 Tue, Oct 25, 2022 at 04:00:30PM -0700, Kees Cook wrote: > On Sun, Oct 23, 2022 at 10:23:56PM +0200, Gabriel Paubert wrote: > > On Sat, Oct 22, 2022 at 11:16:33AM -0700, Linus Torvalds wrote: > > > 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... > > Heh. Yes, fortify-string.h is a twisty maze. I've tried to keep it as > regular as possible, but I admit it is weird. On my list is to split > compile-time from run-time logic (as suggested by Linus a while back), > but I've worried it would end up spilling some of the ugly back into > string.h, which should probably not happen. As such, I've tried to keep > it all contained in fortify-string.h. > > Regardless, I think I'd rather avoid yet more special cases in the > fortify code, so I'd like to avoid using transparent union if we can. It > seems like -funsigned-char and associated fixes will be sufficient, > though, yes? I thought some of the motivation behind the transparent union was that gcc still treats `char` as a distinct type from `unsigned char`, so gcc's checker can still get upset and warn when passing a u8[] to a string handling function that expects a char[]. (Once the -funsigned-char changes go in, though, we should probably decide that s8[] is never a valid string.) Jason