Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2423014rdg; Mon, 14 Aug 2023 01:50:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUsWQgiiuU42ImagMWQYrWWo5e/7G0yus4orf12KuefPfqo0D/039eRvmCKTvZEEyWMGa/ X-Received: by 2002:a05:620a:29c1:b0:75b:23a0:d9dc with SMTP id s1-20020a05620a29c100b0075b23a0d9dcmr11674744qkp.50.1692003054259; Mon, 14 Aug 2023 01:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692003054; cv=none; d=google.com; s=arc-20160816; b=h0ZA/x3Yw5JyH3OF+eVutnvvUg0RXPPnh8WaBY3KQ60OU3hLr1NZOqqwGJH1zEX2z1 7fRG2Q5cB+tb6fMnmkyeokZnrc7wD4XWVAZuNsEt+noZZ1ASYQzLvblYgI6V3LzoRD1e kd9d1P91IEoySx08guHT4/AljRn9sgeyMF+Y8oqhIcxRaZtHYQU1/jB+xYIacc0HXCo2 oZAUggEauM5RIwRYkjmslMoSjVNDwwvTQK29yVZ1rC4XVpPYXQ8p8cy+Stdm4ixqvn7a N9EC/GrrVq31w4kgIjWDXW5U8CnqOfYz0uG68JqSYpqQzOgsrcpOBvFDVw4pKUmk8sm6 yCFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=H33gECP+9hXyb+EizpAzFVTxGWbGL8MsN4gYGXEf7/Q=; fh=nzNgyTxlA9XnS/sOuPBfGlqHtSMUdSF7mRqovTWNBDg=; b=ydPITcVjw8T8BWVs3/ILraXs/sCT80VA3D1NXMOQPH7a0NqP7o/uVMAn0JTGRUbJQV cPIT5Nf8UYzTu4fdib9cNrRbJQG+z7DXmkeNvVo8QwIBOq04wAHHDY6uaslnVQrTKUFg jq+e0FGUAyIm4k4V0GK0zBMOXJMBu1cvIXghBvpkdKpVxtNBcRlozmUcjio2ZoAwoBW+ ne3ciCWB1rKv1t7UmCmrSyZqAevEv6/w/CRUtN+ZSlFYbVq1vNzBt+SADKhRk/6QXoJZ PeZw4TYHtynT6PbSnDXBRfvXao2jAfbY4a5L6RPysY0tp/2aTyp9lkJCi/V77vgXzMPP Fzvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MMvrviWM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u144-20020a627996000000b0068708a8e6c8si6909626pfc.122.2023.08.14.01.50.33; Mon, 14 Aug 2023 01:50:54 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MMvrviWM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232459AbjHNI2V (ORCPT + 99 others); Mon, 14 Aug 2023 04:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234930AbjHNI1s (ORCPT ); Mon, 14 Aug 2023 04:27:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134B110B for ; Mon, 14 Aug 2023 01:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692001614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H33gECP+9hXyb+EizpAzFVTxGWbGL8MsN4gYGXEf7/Q=; b=MMvrviWMD3qHlkzdgt46YDVKHYQEEJ1XI5SPpWyJdFau2BA3wOpxHdyJF2u4ROgAiZiKT+ eFSG6FpDr3AgbsYrHRXIm38PcPQutf2zCkPk9YCWBw6NCdwYTXfrkn7ZRpQOaQHJQFC/yJ Dq98gUrb6wpztBvMyNSm2fC98G8JVz4= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-478-UZ9e3W2COM-03RqOQaRmKA-1; Mon, 14 Aug 2023 04:26:52 -0400 X-MC-Unique: UZ9e3W2COM-03RqOQaRmKA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 174012A59575; Mon, 14 Aug 2023 08:26:52 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FB41121315; Mon, 14 Aug 2023 08:26:50 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20230813122344.14142-1-paskripkin@gmail.com> References: <20230813122344.14142-1-paskripkin@gmail.com> To: Pavel Skripkin Cc: dhowells@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, pabeni@redhat.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+cba21d50095623218389@syzkaller.appspotmail.com Subject: Re: [PATCH] crypto: fix uninit-value in af_alg_free_resources MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3954479.1692001609.1@warthog.procyon.org.uk> Date: Mon, 14 Aug 2023 09:26:49 +0100 Message-ID: <3954480.1692001609@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 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 Pavel Skripkin wrote: > Syzbot was able to trigger use of uninitialized memory in > af_alg_free_resources. > > Bug is caused by missing initialization of rsgl->sgl.need_unpin before > adding to rsgl_list. Then in case of extract_iter_to_sg() failure, rsgl > is left with uninitialized need_unpin which is read during clean up Looks feasible :-). > + rsgl->sgl.need_unpin = 0; > + The blank line isn't really necessary and it's a bool, so can you use 'false' rather than '0'? Alternatively, it might be better to move: rsgl->sgl.need_unpin = iov_iter_extract_will_pin(&msg->msg_iter); up instead. David