Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3297315rwo; Fri, 4 Aug 2023 02:37:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGb3jAnR/FdCniQWNJXGr592R6X28HKJZY0NbAoSZXekMLE5213FQx2JGxeEifkZBbdkNQo X-Received: by 2002:a05:6a20:9143:b0:132:7fb3:3325 with SMTP id x3-20020a056a20914300b001327fb33325mr1187946pzc.59.1691141828506; Fri, 04 Aug 2023 02:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691141828; cv=none; d=google.com; s=arc-20160816; b=sXte9jbpvlf3XoqGvNK5mh+bzQ+YJFBTKGWWWGtuOBWYdsIBDK5Wpzq+yOuQjUJ6Kr XoP19tmo0/aQRnWM5/r3bwYlijqVMyK3TwncMrXgI3mKUeEXdVsNTQkbYaf33fdeSJhn UQMoSyQUSPSqo+2o+xug5OdX+F16bGzfqBN6j03Vjr7wa+46Fd9F8FjHqCHnS8B0AfdG 2KgFdvyH6UFx8qkvan9zTTD3vqxZdqoTE7wjdNpWFeFZkKRXxx6lTbm9BzHAmY1W6IkP IJJvj/cFaP+bE5/rg3R3akQtXYL0NCpROTEm3uIW7ohoag2j2k2rlimFGhpgdeXyeB1L QHgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RGxj+6tymK6UTU4XHQf+qLn2MbZdGdyEyarzKG9Y2EA=; fh=h7zfuCahbSL+azO4bWfV6+AuSjodSV/ykkDVIc1qXvY=; b=C6JzmkxY5GX9+qITPhArsf/omaa8LqluVPyrjKrMnpgqNVKW1wwkKyTZs7qIHaIMtF n7AgX2rzcE+8XBevmblX8XIuDZ8zYpX6z6GeGR6535uBY7ZIjNl5Ap7QuntSWgybunwC c2rr/8eZHC8xUdKDO3j5PuC7j8OMJ06mpTAshMpEWe8PQ+fFO474cthuz5jaWWZ1gPox RVFGEr5drefOjDT4Keci2KPh8Dhgai6W1LPi4k/+4JEIcWMCNltnc73CSlR3RlfJkCAK DxGXEdRFMPs9HwSNoYGRRlwcMDPpCwrhf2XgaDcXqDc8bSJAupXygPbmlZdbweziAGZg myPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx9-20020a170903138900b001bb2093efb6si1382144plb.45.2023.08.04.02.36.54; Fri, 04 Aug 2023 02:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbjHDJOr (ORCPT + 99 others); Fri, 4 Aug 2023 05:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjHDJOR (ORCPT ); Fri, 4 Aug 2023 05:14:17 -0400 Received: from 167-179-156-38.a7b39c.syd.nbn.aussiebb.net (167-179-156-38.a7b39c.syd.nbn.aussiebb.net [167.179.156.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E14C49EC; Fri, 4 Aug 2023 02:11:52 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1qRqqT-003ayv-PZ; Fri, 04 Aug 2023 17:11:42 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 04 Aug 2023 17:11:41 +0800 Date: Fri, 4 Aug 2023 17:11:41 +0800 From: Herbert Xu To: David Howells Cc: =?us-ascii?B?PT9VVEYtOD9CP1QyNWtjbVZxSUUxdmMyN0RvY1NOWldzPT89?= , Paolo Abeni , Sven Schnelle , Harald Freudenberger , Bagas Sanjaya , linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, regressions@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: Fix missing initialisation affecting gcm-aes-s390 Message-ID: References: <97730.1690408399@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <97730.1690408399@warthog.procyon.org.uk> X-Spam-Status: No, score=2.7 required=5.0 tests=BAYES_00,HELO_DYNAMIC_IPADDR2, RCVD_IN_DNSWL_BLOCKED,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS,TVD_RCVD_IP, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jul 26, 2023 at 10:53:19PM +0100, David Howells wrote: > > Fix af_alg_alloc_areq() to initialise areq->first_rsgl.sgl.sgt.sgl to point > to the scatterlist array in areq->first_rsgl.sgl.sgl. > > Without this, the gcm-aes-s390 driver will oops when it tries to do > gcm_walk_start() on req->dst because req->dst is set to the value of > areq->first_rsgl.sgl.sgl by _aead_recvmsg() calling > aead_request_set_crypt(). > > The problem comes if an empty ciphertext is passed: the loop in > af_alg_get_rsgl() just passes straight out and doesn't set areq->first_rsgl > up. > > This isn't a problem on x86_64 using gcmaes_crypt_by_sg() because, as far > as I can tell, that ignores req->dst and only uses req->src[*]. > > [*] Is this a bug in aesni-intel_glue.c? > > The s390x oops looks something like: > > Unable to handle kernel pointer dereference in virtual kernel address space > Failing address: 0000000a00000000 TEID: 0000000a00000803 > Fault in home space mode while using kernel ASCE. > AS:00000000a43a0007 R3:0000000000000024 > Oops: 003b ilc:2 [#1] SMP > ... > Call Trace: > [<000003ff7fc3d47e>] gcm_walk_start+0x16/0x28 [aes_s390] > [<00000000a2a342f2>] crypto_aead_decrypt+0x9a/0xb8 > [<00000000a2a60888>] aead_recvmsg+0x478/0x698 > [<00000000a2e519a0>] sock_recvmsg+0x70/0xb0 > [<00000000a2e51a56>] sock_read_iter+0x76/0xa0 > [<00000000a273e066>] vfs_read+0x26e/0x2a8 > [<00000000a273e8c4>] ksys_read+0xbc/0x100 > [<00000000a311d808>] __do_syscall+0x1d0/0x1f8 > [<00000000a312ff30>] system_call+0x70/0x98 > Last Breaking-Event-Address: > [<000003ff7fc3e6b4>] gcm_aes_crypt+0x104/0xa68 [aes_s390] > > Fixes: c1abe6f570af ("crypto: af_alg: Use extract_iter_to_sg() to create scatterlists") > Reported-by: Ondrej Mosnáček > Link: https://lore.kernel.org/r/CAAUqJDuRkHE8fPgZJGaKjUjd3QfGwzfumuJBmStPqBhubxyk_A@mail.gmail.com/ > Signed-off-by: David Howells > cc: Herbert Xu > cc: Sven Schnelle > cc: Harald Freudenberger > cc: "David S. Miller" > cc: Paolo Abeni > cc: linux-crypto@vger.kernel.org > cc: linux-s390@vger.kernel.org > cc: regressions@lists.linux.dev > --- > crypto/af_alg.c | 1 + > 1 file changed, 1 insertion(+) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt