Received: by 10.192.165.148 with SMTP id m20csp4929594imm; Tue, 8 May 2018 17:49:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoYXJT3F4+Msv6MQujKjeYBopBX5ipa09GfRZkSdnKL3m6WNOoxKcpgA7gso9n6hQua8mn3 X-Received: by 2002:a17:902:7441:: with SMTP id e1-v6mr29075131plt.238.1525826988898; Tue, 08 May 2018 17:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525826988; cv=none; d=google.com; s=arc-20160816; b=cRIYiRfVSNYYKsn0RBW7TZLjhwXbnJUUGMK/lHuU79Z1MI7PsT8hvJK8XtwsCw+qG0 6hd+4VsUxQnbKY5zhm03zPUFLtjYBKIhsaiy4Vngyp9B07y5hDqR7VQ8M1oS3hIvH7OU sdIAHSwYL23XNaO/89GlqoRMRHyOs8uYoX6m9NcKjrZsOzCZYX5DfJbK0fhicUs7jQ59 JsYZUkYUNqZ86Kgk/ly1T3mJXLU0/saTfsbUBAxnVA8aA5Yhl20hmdLFpwPyYmojvzOp oXWSEqQIxenEPxtrOWQmnsarwTbSfW+YnAMPeT2ksFOFBOXagQbZasujvLBXO+HKAS9m Z44w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Rq5Ei+yTQGW3g1+DChjn68auNowQKjAwVXPsv/mglwY=; b=wPDYHqXd1pDBWF963gbITUnJ1gpYz1gHz9+Rukjf8tlscKxZKby+Z3udqtX+BkHYyJ z1EoqSPKXbyNND3q2I9LEdwMCfOZd5IJBp4p9mTfvi8Sy53fRhfd+VFgfO4faxalAQg3 2iHr07Sq+5i8haz3FnjIdS0RKjrd59/g21l6/Ox0MwPZ8+eS5egCW7B8j/7xUw6wGlVT c7X5an7H6JCEftIvQDOfMcN1yKiZqFqT7SnEBZa5y9Ya7EEWOigTbrRibEfdBdNiNmSb EKSiw84tCrTBxxR1Oqw/CNJo+S5WAW3/VkSjVim341mFM1vYQ7kuFdatwUyWeA1B9RTl +HaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cid6rXa1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9-v6si21129195pge.290.2018.05.08.17.49.34; Tue, 08 May 2018 17:49:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cid6rXa1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933345AbeEIAmo (ORCPT + 99 others); Tue, 8 May 2018 20:42:44 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:42215 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933134AbeEIAml (ORCPT ); Tue, 8 May 2018 20:42:41 -0400 Received: by mail-pg0-f67.google.com with SMTP id p9-v6so18979047pgc.9 for ; Tue, 08 May 2018 17:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=Rq5Ei+yTQGW3g1+DChjn68auNowQKjAwVXPsv/mglwY=; b=cid6rXa1Y0961Yppkw6eDYPlvGrr+3StQiaAPYzZbWDScElW1DvgrUGqM8KVfUSm+Y WiCQ79D6RaIrfSwWYQvhiywgBzH1odEhxIHT99V2SeEdOCCrypFJFi5BXHNo3wi+FbVk 35EUhkuxqyoCv/7t/OPex8akhEDrZtUxHpxkk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Rq5Ei+yTQGW3g1+DChjn68auNowQKjAwVXPsv/mglwY=; b=Th4/EMjthbT8Swdbg5b5oq79hfkOKSnHdBfqsy6PU1MKeldUv5tAbrcc0L/8wIfvAa bXn2LvsP/hPjTdzqzn6gKi81RWbu4g5VhAS/0YZuiUMTKJsgmF5DRVxbJT/cOp+0MFrY FXGTSS2Rx6bJsganzEBo5F5dy1ckNFj/nzZbGdrOI4I0CpPX/df3fpxYW20TEDIcY02N fLQ/vOtMtM5Vl6M7JKN5/wdZDXRus1fc8+qpZo/wJNUa4dWKdGoZGAPx2o/7ujUQCuO8 1TbrJps9stARN5GGsV9pj/PINtcSMdMNqZrK+2fh78tw4xCuOORRes9XoiMEh3s4eMlM 8yKw== X-Gm-Message-State: ALQs6tBwOSlS8S/n6cwKq2XlTCgEQ6MV4yX3vbv7ZNP7VqTGj8wzuHGA 4ZyGmNqTBcSZv+tVxMXaSSQTaQ== X-Received: by 2002:a65:5183:: with SMTP id h3-v6mr33651396pgq.58.1525826561340; Tue, 08 May 2018 17:42:41 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id s9sm53889473pfa.141.2018.05.08.17.42.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 17:42:39 -0700 (PDT) From: Kees Cook To: Matthew Wilcox Cc: Kees Cook , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Subject: [RFC][PATCH 00/13] Provide saturating helpers for allocation Date: Tue, 8 May 2018 17:42:16 -0700 Message-Id: <20180509004229.36341-1-keescook@chromium.org> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a stab at providing three new helpers for allocation size calculation: struct_size(), array_size(), and array3_size(). These are implemented on top of Rasmus's overflow checking functions, and the last 8 patches are all treewide conversions of open-coded multiplications into the various combinations of the helper functions. -Kees