From patchwork Wed Aug 1 06:09:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10551725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CCBF13B8 for ; Wed, 1 Aug 2018 06:10:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CFCB2A4ED for ; Wed, 1 Aug 2018 06:10:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 513672A51C; Wed, 1 Aug 2018 06:10:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27F902A4ED for ; Wed, 1 Aug 2018 06:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733194AbeHAHxu (ORCPT ); Wed, 1 Aug 2018 03:53:50 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42020 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbeHAHxu (ORCPT ); Wed, 1 Aug 2018 03:53:50 -0400 Received: by mail-pg1-f194.google.com with SMTP id y4-v6so10263925pgp.9 for ; Tue, 31 Jul 2018 23:09:53 -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=CpRCrukzwPkVZPwY6hxKTkGSn5bNvEkKc6CQz569+i0=; b=GUbpiEnEXwcRSgjf34pwFPQdPW9/HtsRrnf+1alaGiyXrksEdSUeeMr2DBw3jtwNTQ Dp/L5bvrBOy9aclfsl0U/SuyHS4acJjwV+yqhSNIKh83t6TQAHBw2FCBdOwPU8WRguIU reJ1vpGvEsh2+4qAkflAxb9mC7FG3rRG/S52M= 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=CpRCrukzwPkVZPwY6hxKTkGSn5bNvEkKc6CQz569+i0=; b=B255POiP905M8ciTn8P4m5U5NpCVAhz6EtK4yRg87iDXZhCI1mKjz8Fe61cxQg7OHm tkRN1yOe/EacxvEOPY3okypUUeXEd+vmuWmX7rHFB8Y6w1k6AjhLIN1wrYwg1JLdoRhP naoTanVDgGzVn4U0tO7w3+F7O/XHlTAmPJwU/wfbgfypY9JREPVXCIejqp1tAr543F6a zWbR1GqK7vtJt+/Iw30YS/i4JHuEeNDzW0qLa34iS0zmJtDVeY85tzz/CUFAPiXJI/mr WHSLFLDzA+XbaRS7OMwGcYjcpLwY9w6ZPGmdB0DBJrl9cxKq8FMIZrYi/AcPrA+2M9WH 6giw== X-Gm-Message-State: AOUpUlHq4Z+IZqEd9bOoTVSLOe9kQO2NxEk72y3Ar+hSRy451BTL3q4N 3kgT6v+MZ4GxSHL742GvHLLtAA== X-Google-Smtp-Source: AAOMgpfTo3FFXuv/DBnTLdbtqC5VlP8fTFjZh6cylcV3zOh3v4X9fgtUEGxKyrtwJj8rQKhlxRYFXQ== X-Received: by 2002:a62:b604:: with SMTP id j4-v6mr16411687pff.199.1533103793666; Tue, 31 Jul 2018 23:09:53 -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 v20-v6sm44499362pfk.12.2018.07.31.23.09.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 23:09:49 -0700 (PDT) From: Kees Cook To: Rasmus Villemoes Cc: Kees Cook , Jason Gunthorpe , Leon Romanovsky , Bart Van Assche , Doug Ledford , Dan Carpenter , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] overflow.h: Add arithmetic shift helper Date: Tue, 31 Jul 2018 23:09:44 -0700 Message-Id: <20180801060947.16670-1-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds the shift overflow helper, selftests, and first usage. -Kees v3: - add even more test cases (type mismatches, more signed overflows). - fix documentation typo on argument name. v2: - swap out selftests with framework from Rasmus, add lots more tests. - drop double-assignment in helper. Jason Gunthorpe (1): overflow.h: Add arithmetic shift helper Kees Cook (1): test_overflow: Add shift overflow tests Leon Romanovsky (1): RDMA/mlx5: Fix shift overflow in mlx5_ib_create_wq drivers/infiniband/hw/mlx5/qp.c | 5 +- include/linux/overflow.h | 31 +++++ lib/test_overflow.c | 198 +++++++++++++++++++++++++++++++- 3 files changed, 232 insertions(+), 2 deletions(-)