Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp582866pxb; Thu, 15 Apr 2021 01:27:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4d/K9q40VfKmIH6JDIpcLJRMRfsdED6RtjskUEgIi767wqriakRtAygWPP/FujxZBn+pJ X-Received: by 2002:a05:6402:74b:: with SMTP id p11mr2818389edy.40.1618475270185; Thu, 15 Apr 2021 01:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618475270; cv=none; d=google.com; s=arc-20160816; b=t6xRv1Of1uXyN4JbJEC0ZS9H8fWGdSVhoqPeK7XhyF/JrqwFuuzL5kekb/vaSQ0kXu OPfkgl7dCk1X197wcstjuRUgvFyaBDT+IIR1/Abe2RO+mQbbvFhGCNvm6RNdasIfIUp3 27+o9DVBvwWnv7V3YU4YuBI2pONdRJFn/afcamRqtv+RojtZ+re4GPqDNSikZiDh4l+j ZxaM1O0JQyzqh514IFibjPrFzMmcOAIJwwAv1bt8QmsY/RYHZIxwRhBTRhekZ09DObgJ sSUaYCrHaO3PiunTYS3fWaA4ZIOKCMcnvV/NYT+wJRGm2q9GPABC+8oBVYCbMlQIFdLZ 7IIg== 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=UHWg1xA+byouMkbExhqQ+b/rsLiIiMMhCxQafCJ8FbY=; b=p3uZP13qkmHym6wH4KR0WjUnf/p2cmCCRpmLpkJvK+4h5Z4bB3bCni+jX550K5GLck haY49sUBpuV9ErlpYoLzapEqmjbjLu0xqmtwDJNedehB0SWGD/spsIlkr89HxgnssM7D XKozaEsKDzfcR/BTlkrrbHT26UVGsZfyLpidrR5pqAq1syLVua5aHzNwa5voLl20cz3U RAhSNa4eE6V/XObjpOM5tBcpyLdWHOzMxRVe/BuNTrS2E+6ntt2ioLphwky4LhLY8zYv xk2unRFOCr+Engf5nZVuswxosBJLzErB0+fkRGkVraMrS6r2Q8XCUx/qg5+1lWxx3jJM gUXw== 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 e13si1835956edn.457.2021.04.15.01.27.25; Thu, 15 Apr 2021 01:27:50 -0700 (PDT) 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 S231531AbhDOI0v convert rfc822-to-8bit (ORCPT + 99 others); Thu, 15 Apr 2021 04:26:51 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:29062 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbhDOI0r (ORCPT ); Thu, 15 Apr 2021 04:26:47 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-130-oIZcnRhLMq2oldGnfAngVw-1; Thu, 15 Apr 2021 09:26:22 +0100 X-MC-Unique: oIZcnRhLMq2oldGnfAngVw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 15 Apr 2021 09:26:21 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.012; Thu, 15 Apr 2021 09:26:21 +0100 From: David Laight To: 'Kees Cook' , Miguel Ojeda CC: Linus Torvalds , Miguel Ojeda , Greg Kroah-Hartman , "rust-for-linux@vger.kernel.org" , "Linux Kbuild mailing list" , "open list:DOCUMENTATION" , Linux Kernel Mailing List Subject: RE: [PATCH 00/13] [RFC] Rust support Thread-Topic: [PATCH 00/13] [RFC] Rust support Thread-Index: AQHXMZgZR6TAvlURwUWbKsHSAM883qq1O6Fw Date: Thu, 15 Apr 2021 08:26:21 +0000 Message-ID: <8eaa65020c0d44ed9122fed5acf945a0@AcuMS.aculab.com> References: <20210414184604.23473-1-ojeda@kernel.org> <202104141820.7DDE15A30@keescook> In-Reply-To: <202104141820.7DDE15A30@keescook> 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 ... > Besides just FP, 128-bit, etc, I remain concerned about just basic > math operations. C has no way to describe the intent of integer > overflow, so the kernel was left with the only "predictable" result: > wrap around. Unfortunately, this is wrong in most cases, and we're left > with entire classes of vulnerability related to such overflows. I'm not sure any of the alternatives (except perhaps panic) are much better. Many years ago I used a COBOL system that skipped the assignment if ADD X to Y (y += x) would overflow. That gave a very hard to spot error when the sump of a long list way a little too large. If it had wrapped the error would be obvious. There are certainly places where saturate is good. Mostly when dealing with analogue samples. I guess the problematic code is stuff that checks: if (foo->size + constant > limit) goto error; instead of: if (foo->size > limit - constant) goto error; David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)