From patchwork Sat Jun 10 02:59:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 9779619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4E3960393 for ; Sat, 10 Jun 2017 02:59:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6ED428556 for ; Sat, 10 Jun 2017 02:59:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB53F285A6; Sat, 10 Jun 2017 02:59:55 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 0CA3F28556 for ; Sat, 10 Jun 2017 02:59:54 +0000 (UTC) Received: (qmail 25969 invoked by uid 550); 10 Jun 2017 02:59:43 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 24017 invoked from network); 10 Jun 2017 02:59:34 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=mail; bh=9PiH 7cCY5kMrzUnQlfizwIG4g1w=; b=qAHCTUUazzkT7/i9Tj72Wjvrq31TPZzZTkN2 JG9fkGWoLIFZPL/ccctxAVVjDloO3jSI3yOYx1X/SxBvRGP9Zj1hXvYTO3hEkgvG s6Xr0UiwFsifuyE40bHwHaocbb6f+PG7n35OyU4rZcRad/PbQuqTayhXAl12OUyv dadYEdgBTW5lk9suQLc7VgQdf6MJd3UgRAQifGKAwFA03gREC3HtQADwoseBRkUR Io6w89XxlmYHGVJrrgEm9m2iOA2KCjn/KytFNLkLc4o0Qev5Xo4Ockqy8laegGqF cwAl170E5ovWAmNis8EGFJhDpAjCiHCDb3CVjX93lcjFETKy2Q== From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: "Jason A. Donenfeld" , "J. Bruce Fields" , Jeff Layton , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, stable@vger.kernel.org Date: Sat, 10 Jun 2017 04:59:07 +0200 Message-Id: <20170610025912.6499-2-Jason@zx2c4.com> In-Reply-To: <20170610025912.6499-1-Jason@zx2c4.com> References: <20170610025912.6499-1-Jason@zx2c4.com> Subject: [kernel-hardening] [PATCH 1/6] sunrpc: use constant time memory comparison for mac X-Virus-Scanned: ClamAV using ClamSMTP Otherwise, we enable a MAC forgery via timing attack. Signed-off-by: Jason A. Donenfeld Cc: "J. Bruce Fields" Cc: Jeff Layton Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org Cc: stable@vger.kernel.org --- net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index fb39284ec174..12649c9fedab 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -34,6 +34,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#include #include #include #include @@ -927,7 +928,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, if (ret) goto out_err; - if (memcmp(pkt_hmac, our_hmac, kctx->gk5e->cksumlength) != 0) { + if (crypto_memneq(pkt_hmac, our_hmac, kctx->gk5e->cksumlength) != 0) { ret = GSS_S_BAD_SIG; goto out_err; }