Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5840925rwj; Wed, 21 Dec 2022 07:40:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXt6kWH2C4QQ0UVaIyXRCBjCsqN2aVSFOuzOfBJOm09N6nRplkILilLQUG4LXFBi9uFzszLt X-Received: by 2002:a05:6a20:c512:b0:af:8e92:411c with SMTP id gm18-20020a056a20c51200b000af8e92411cmr17654616pzb.44.1671637238032; Wed, 21 Dec 2022 07:40:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671637238; cv=pass; d=google.com; s=arc-20160816; b=uS/1zT3/mHbmw9R2f5daeEuA09GaVV144sH9C/7JAlLUZuaJwNLoY6vxma8QcvlVHJ jUKOGjmIcE3dkQ8fj/fV7QzbT/yIHi9XFLatxWkdHbo6Fm9V44azkYXZpRYLDWL6UY7m Q4XZ32DplXx3cLWQeFb5lKydfxZ5lGNXycO4DGYz8gyJ2rfVDHm8K9KD9bg2R5PnDsja 17PerO1mc5uYKb0ofesDdw94abwdRIWR01+eb3b+AkjhMRSo6aN3pWfN8L3EgwpMhkz4 UuPaHu1nQ2Aaw+yauWyBzy11CgfgEGXR9BEYkbE0g8Q37cC0HhQj9beNrJF9tbde7jOL Ozrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=R9VEjpQddD5IGOOllmqtHQjytTZrrqtV1G4TyW1fwqs=; b=NnDuaQafA1dgg3pneumjDXANLHKT2Q0AfZkCOehVEQi91xFwpgvh2CQTXv6lH6lIdz NwkPcgBsSxFOX5yfISsbGB2UCPGt00dbkPJaWUPkL7vsguEgrWbKdx0HTFyMBsjZggxg 4tKg8lKsdyV8PgFurGRDShXh1P4ZImrGBQKqFUbWz1Xm/8RgVA1yVcFesDGKHdkMTQCt WHHxDwBPCUSQ58e/wDE8AS2eMbziwLqloER4ARA9Uj3yIXOOLzU8hrET8OdTKGtE4hSH z8wd1Dl9otFqj3yImdGRqDtKwMYo+JgcNGDFRgwribh3u2OyCogMzMXpk3Kj59OFAMlI 2OnQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@prevas.dk header.s=selector1 header.b=UPpxLmk3; arc=pass (i=1 spf=pass spfdomain=prevas.dk dkim=pass dkdomain=prevas.dk dmarc=pass fromdomain=prevas.dk); 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=REJECT sp=REJECT dis=NONE) header.from=prevas.dk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x70-20020a638649000000b0047947d45f57si16486829pgd.745.2022.12.21.07.40.28; Wed, 21 Dec 2022 07:40:38 -0800 (PST) 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=@prevas.dk header.s=selector1 header.b=UPpxLmk3; arc=pass (i=1 spf=pass spfdomain=prevas.dk dkim=pass dkdomain=prevas.dk dmarc=pass fromdomain=prevas.dk); 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=REJECT sp=REJECT dis=NONE) header.from=prevas.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234450AbiLUPeQ (ORCPT + 68 others); Wed, 21 Dec 2022 10:34:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234785AbiLUPdv (ORCPT ); Wed, 21 Dec 2022 10:33:51 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2110.outbound.protection.outlook.com [40.107.20.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A8B286EB; Wed, 21 Dec 2022 07:29:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LKq+xWmkWN8SF5JudabQXCK0ilwmA/x7b7QqVMkirJsILrVzWrswRGud2h5FiQJnk0Go04/0wHk/T14s6+eT4TeO3coXcI9qrv6hnSzys1N3MCZVu4HnJsvwOHhR+xiKPDFTM7gFio03D9d52/IiMyEbpgbBMBFDxDs2pja9rDH8gds1OiUeeu8ANYJ6BTO0kzIVgDvOnQYJThlEXATTs48XWXApSy7diYGym1ll/+Jq3Yn9dGEFaaXCunYi73c3yq16FU4hf2ilIl39GQsn7pzHULT1jsBalwak2WrAUOQNyQNYSlgUPa9FixzEaWJAaBdhmUHVSzgmK8XEJe05Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R9VEjpQddD5IGOOllmqtHQjytTZrrqtV1G4TyW1fwqs=; b=mLyB3bCTbEpG0xx7Q36BK667TnpOl0kNZuJf3lXrjs9B3lF7I/roK9YkxesPkpnr7qTnHTASaStPIhWZHuaN9dDZ57YaP9t9dya3b/hMl+/xnHyWFiQG/rD3X1adQrSW0G8p+cE0R/UcKH7Mfm+P9eaZjhZqQ+o1NNH5Fd0Ajc8IExsQE+Cu/zOuYNyf7n03t/wC4pfkhoVMbv+/I7GeYJ/JZ+ObyghoNyKPm5ABwZ2SYehXnqlOo37t4pbN2D8RfRm7XxfCoAHDGSP8p7aP2DSEtPiAIpk+rBgzkHJDREaH51dGlAOMN6Raf4573y4FMdGHVlWwck2y97AomE8tAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R9VEjpQddD5IGOOllmqtHQjytTZrrqtV1G4TyW1fwqs=; b=UPpxLmk3P9aKvZ/9ZmPg940Me5VrCGhNOE8c4lZaVepQdjVsUTOqf2VahTo5t2UsuG0qR9ayYPvuodzhzR3VTaVjaa+OySJCJtbF9JEqM/slHhx+8xyMqwHSz8QxW8ZF8pC6nB2OiAQeH7khRqaAJZc0nGnYgFHneKWhsLd8hMc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:34a::22) by AS8PR10MB7524.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5af::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 15:29:14 +0000 Received: from DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM ([fe80::722b:5d41:9862:10e5]) by DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM ([fe80::722b:5d41:9862:10e5%8]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 15:29:14 +0000 Message-ID: <1a27385c-cca6-888b-1125-d6383e48c0f5@prevas.dk> Date: Wed, 21 Dec 2022 16:29:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2] kbuild: treat char as always unsigned Content-Language: en-US, da To: Geert Uytterhoeven , Guenter Roeck Cc: "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 , Linus Torvalds , Andy Shevchenko , Greg Kroah-Hartman , linux-m68k@lists.linux-m68k.org References: <20221019203034.3795710-1-Jason@zx2c4.com> <20221221145332.GA2399037@roeck-us.net> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: GV3P280CA0090.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:a::31) To DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:34a::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR10MB5266:EE_|AS8PR10MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: 2bbdf601-8bba-4e28-73e0-08dae3681ddd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C9OLzdG1Ba56IOY0A6eJKiZ83w4bEv2RbVpXP/jU+9kMkTFYKrXXpp7FUrOdeSx5WGOi+Y4WRJpvREU4PAvqD050Vx7fPlfVf72zX9lmtjjc6l3Q/UcDun8IpKkX9R7p/rMa638VNYE85Z72r7L84MB9Nfop0ZXTvrZPolu9V7rnk+ruRM03tZHH6ECO28bMWi0hHsTL8dGjR9I+60/rW96qk33o0iM4vSjZEM5dHrlH9uxyWBHRC4r/zR5jAFo6YG7g/kpQFllE5p/ZJDBv2e2yvuJY+JchezNBi5oWwCr4K/QFhHpgx9B0pHif3ULfd82UYoc3RlgmRd95Mg6iV44+osCEq3rRX1XIrxS9QcgycOkTvZRxmhj0R/sJO+/kBkzYTNiatibEu7XUVzYBupRCBMFg/UZpDAMXvpPjkzfy3OXGX5SYtrU/JY3ca7O1arKCthNtXgsRRQCFCvV81Em9jGgVa73kYlEUd5qYpMDb3Ax4YKLQhENBATbk7UC/rD8dE7pQsn7ANwoyZtI0bWsJRV2goLs1otpH87IKQwi4O7fRUwSaEOrLM09BPY1m1z5mLUe9FFhbUI4fNv3Qw9p3HP7uvtRY+UaN/zqWI901Lj8WCjiy7ys4Y+1iohuujKUQvEpMGGTzkk3hsXtNGkDa4gSg9kEggoLWp9l5Q1r5DZXq/6xNNM95PRy5fcxYxshGhnSB+2RJpMzQmIjSkDycwF/i2ZuivwLlndn9FzjLEjYK7v+Jn9bBpA4izMWmncG8A1v3zCHZufcCRM3sjtu/o2ifcrrRlU/we3CbQQc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230022)(136003)(376002)(396003)(39850400004)(366004)(346002)(451199015)(36756003)(31696002)(54906003)(86362001)(110136005)(478600001)(316002)(41300700001)(38350700002)(6486002)(6666004)(44832011)(66946007)(5660300002)(8676002)(66476007)(4326008)(2906002)(66556008)(8976002)(7416002)(8936002)(966005)(186003)(52116002)(66574015)(26005)(38100700002)(53546011)(6512007)(6506007)(83380400001)(2616005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QzZmMTZVRXZlcFJNM1hVRkFSMUJNRU9RSVg1dzQvdUJlbFNlcVFxNVN2aGZL?= =?utf-8?B?cUZCK1YwZ1h5L2dZQm5MMXpHbkhUWTVRWGR6bUE5ZHZsSVVibXFnWVJ2OFEv?= =?utf-8?B?ZHZ4NFhlVW5LdVY4a0QzU2Vld1ZJSVd3VUlkK0FMVEtXRlJkclgxaXVoVy83?= =?utf-8?B?MEtmV1FkbkZGby9UUjFwOTErTWpicy9zczdpRXA3RkFhWTJDZGk3M3Q3NFBl?= =?utf-8?B?b2FySFJxcEp6YVN0TmlKRXRVcDRGQVZyamRKUEZpLzQ2ZE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3B2UlpCODlMMG4vMTY4L1dSQXk4dzNPdkF0amlGbE13TG12?= =?utf-8?B?Q01kSGpXcXB0b3ZLQmh1TVBKM0ErUnFkT3c3ekhydWdaeUpRWCtKTDFFVmVH?= =?utf-8?B?dGc9PQ==?= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 2bbdf601-8bba-4e28-73e0-08dae3681ddd X-MS-Exchange-CrossTenant-AuthSource: DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 15:29:14.5065 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AaUAPxt/DfWANVnPypJTN8uv7ajDVMY8f7/Q2+IitiljJb3dTSFWECgkCIf16mWqJpoZ10pyFkcxpaPvFBUTOGat0wpuq48P9jnuIgPjJ70= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB7524 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 21/12/2022 16.05, Geert Uytterhoeven wrote: > Hi Günter, > > On Wed, Dec 21, 2022 at 3:54 PM Guenter Roeck wrote: >> On Wed, Oct 19, 2022 at 02:30:34PM -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. >>> >>> I doubt this particular driver is the only instance in which >>> unsuspecting authors make assumptions about `char` with no `signed` or >>> `unsigned` specifier. We were lucky enough this time that that driver >>> used `clamp_t(char, negative_value, positive_value)`, so the new >>> checking code found it, and I've sent a patch to fix it, but there are >>> likely other places lurking that won't be so easily unearthed. >>> >>> So let's just eliminate this particular variety of heisensign bugs >>> entirely. Set `-funsigned-char` globally, so that gcc makes the type >>> unsigned on all architectures. >>> >>> This will break things in some places and fix things in others, so this >>> will likely cause a bit of churn while reconciling the type misuse. >>> >> >> There is an interesting fallout: When running the m68k:q800 qemu emulation, >> there are lots of warning backtraces. >> >> WARNING: CPU: 0 PID: 23 at crypto/testmgr.c:5724 alg_test.part.0+0x7c/0x326 >> testmgr: alg_test_descs entries in wrong order: 'adiantum(xchacha12,aes)' before 'adiantum(xchacha20,aes)' >> ------------[ cut here ]------------ >> WARNING: CPU: 0 PID: 23 at crypto/testmgr.c:5724 alg_test.part.0+0x7c/0x326 >> testmgr: alg_test_descs entries in wrong order: 'adiantum(xchacha20,aes)' before 'aegis128' >> >> and so on for pretty much every entry in the alg_test_descs[] array. >> >> Bisect points to this patch, and reverting it fixes the problem. >> >> It looks like the problem is that arch/m68k/include/asm/string.h >> uses "char res" to store the result of strcmp(), and char is now >> unsigned - meaning strcmp() will now never return a value < 0. >> Effectively that means that strcmp() is broken on m68k if >> CONFIG_COLDFIRE=n. >> >> The fix is probably quite simple. >> >> diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h >> index f759d944c449..b8f4ae19e8f6 100644 >> --- a/arch/m68k/include/asm/string.h >> +++ b/arch/m68k/include/asm/string.h >> @@ -42,7 +42,7 @@ static inline char *strncpy(char *dest, const char *src, size_t n) >> #define __HAVE_ARCH_STRCMP >> static inline int strcmp(const char *cs, const char *ct) >> { >> - char res; >> + signed char res; >> >> asm ("\n" >> "1: move.b (%0)+,%2\n" /* get *cs */ >> >> Does that make sense ? If so I can send a patch. > > Thanks, been there, done that > https://lore.kernel.org/all/bce014e60d7b1a3d1c60009fc3572e2f72591f21.1671110959.git.geert@linux-m68k.org Well, looks like that would still leave strcmp() buggy, you can't represent all possible differences between two char values (signed or not) in an 8-bit quantity. So any implementation based on returning the first non-zero value of *a - *b must store that intermediate value in something wider. Otherwise you'll get -128 from strcmp("\x40", "\xc0"), but _also_ -128 when you do strcmp("\xc0", "\x40"), which is obviously bogus. I recently fixed that long-standing bug in U-Boot's strcmp() and a similar one in nolibc in the linux tree. I wonder how many more instances exist. Rasmus