Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp630423pxb; Thu, 19 Nov 2020 09:45:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzvJwwVRIaziG9NXckfPBJML8HV/YZ6kizLz1WtHD5SjWwHI71WuwzKS17dsoJj6ZrGMs6 X-Received: by 2002:a17:906:e53:: with SMTP id q19mr30347788eji.254.1605807914595; Thu, 19 Nov 2020 09:45:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605807914; cv=none; d=google.com; s=arc-20160816; b=FdTQ8QQrSnZh+T5oihPmPivqmsFfqqQGb+9va2uYoZ8Jo3ASxxu186Zzf6aQ9UfPtB 7/6Qrovyo1Mr/OPfI1yk7CUl2W4WzV6NJC/BNhlXdH8Y3AiY+lXa/hOtlgerYAoZuqiS 8IANJVOre4/OVtooUoh+g0Wu1PX2W5OrLnOhklgOtJpyZ3mekdgWWP962zpr41cTadOl xK6whVAL2bqD79P+M1u8cJDFVrfk8q8YEhgDBDFSYgZwh7eJAWuA5EmvXdb6bRT5sJkN ycbYCwtRBRVwSfFAg4r/sChNVbvkPfmr73RwP1b1IpjZZuzr1T1YWrXJfYM1OPjQ2CcV Xw/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=7G8wvneE/wWILgEzge91gjN3T3mGCS0sIzBAi+smhEE=; b=MVlsfFBHKDYDN/gIy5nHthE7/nTJiFUyIGIqRsgFkwe/wW1mec68TnYbDSZfbKjiFI oboBUfK8a0hkpHpB/QBgeUCcoXw22NgiMopPJR0cNhqE2wvzurG7GgGO9DN4Rh8+rtcZ 55VIvquRJ4qnpbxV+NWIAh7AEAyKUa++sDjz6dxIRA4J0N7jzRfyzg8zyJMzDIG6NRPR aY61l1WhJ8HCbYV45lxwKti2YtzXaI/bajqGXWED4FNb2B2X2H+hy9IvTrKAOvXQQ7Ht tSxv6dD8sUG9eaLtqklhDsYWhLETeFXXh/nYBHNgmBSXNcyKQxuexRHXhHMw8fUPtf0p fdnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si224231ejh.370.2020.11.19.09.44.51; Thu, 19 Nov 2020 09:45:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729523AbgKSRmm convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Nov 2020 12:42:42 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:37349 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbgKSRmj (ORCPT ); Thu, 19 Nov 2020 12:42:39 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-235-PuInSl5ZO8GDYxP6JCcNgw-1; Thu, 19 Nov 2020 17:42:35 +0000 X-MC-Unique: PuInSl5ZO8GDYxP6JCcNgw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 19 Nov 2020 17:42:34 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 19 Nov 2020 17:42:34 +0000 From: David Laight To: 'Segher Boessenkool' , Steven Rostedt CC: Peter Zijlstra , Florian Weimer , Nick Desaulniers , Sami Tolvanen , Mathieu Desnoyers , linux-kernel , Matt Mullins , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Dmitry Vyukov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , netdev , bpf , Kees Cook , Josh Poimboeuf , "linux-toolchains@vger.kernel.org" Subject: RE: violating function pointer signature Thread-Topic: violating function pointer signature Thread-Index: AQHWvpH9jLd/DjVTQ26YGUc47fMkpqnPtbCA Date: Thu, 19 Nov 2020 17:42:34 +0000 Message-ID: References: <20201118132136.GJ3121378@hirez.programming.kicks-ass.net> <20201118121730.12ee645b@gandalf.local.home> <20201118181226.GK2672@gate.crashing.org> <87o8jutt2h.fsf@mid.deneb.enyo.de> <20201118135823.3f0d24b7@gandalf.local.home> <20201118191127.GM2672@gate.crashing.org> <20201119083648.GE3121392@hirez.programming.kicks-ass.net> <20201119143735.GU2672@gate.crashing.org> <20201119095951.30269233@gandalf.local.home> <20201119163529.GV2672@gate.crashing.org> In-Reply-To: <20201119163529.GV2672@gate.crashing.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Segher Boessenkool > Sent: 19 November 2020 16:35 ... > I just meant "valid C language code as defined by the standards". Many > people want all UB to just go away, while that is *impossible* to do for > many compilers: for example where different architectures or different > ABIs have contradictory requirements. Some of the UB in the C language are (probably) there because certain (now obscure) hardware behaved that way. For instance integer arithmetic may saturate on overflow (or do even stranger things if the sign is a separate bit). I'm not quite sure it was ever possible to write a C compiler for a cpu that processed numbers in ASCII (up to 10 digits), binary arithmetic was almost impossible. There are also the CPU that only have 'word' addressing - so that 'pointers to characters' take extra instructions. ISTM that a few years ago the gcc developers started looking at some of these 'UB' and decided they could make use of them to make some code faster (and break other code). One of the problems with UB is that whereas you might expect UB arithmetic to generate an unexpected result and/or signal it is completely open-ended and could fire an ICBM at the coder. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)