Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp19304rdb; Wed, 31 Jan 2024 22:04:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtOfdGj0PYvdwlJtnM5ysRDYZStGQ4InnLehHkdetZU58GS80i7+3dgUyWcUgHilvb7DiU X-Received: by 2002:a9d:62d0:0:b0:6dc:155b:49dc with SMTP id z16-20020a9d62d0000000b006dc155b49dcmr4030220otk.12.1706767473809; Wed, 31 Jan 2024 22:04:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706767473; cv=pass; d=google.com; s=arc-20160816; b=pbOSD3H4GHPlisqnd5jX/SPsMZoqEAWgL22iet9Km2h2qlDEIlj2liRsbXWKu7yYKQ Xp7S7pqAZlqXvncrxmRCM1vwROAbMoa7ZGG0nOxgR8UdiUhRsDhhu2skYgVa8yndgXb5 5dlnxy3qSdvTmtffBJ7RSMW6/iVjkF/pUPdrbnOExbz0U4tP3i2xgtTvTcUbt9mwgbz1 KJjAL2/RTw1GpGCkfB/UBMfvQFJ9A7+4PF8pWiWhtU4BD8LBOuwE40s6Lj9HwnNj8CTX f126oV8+5dIAL0MJMWjbks3grsrm0BAIKqhbdpWWkyBfhjy9mm5kSyXvF4z+asDSVza1 fA6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=jgbdx/AAaJZ7DeK9FOsHQhtQNYQ6A6a2HZZVAxKhKQQ=; fh=cZuQckVGmVHNGyUFZPaaXQGeKvMPtl5Akw30hq/l3uo=; b=WPySBGDiO9kDgGm2WnDk4zGihtqmQLq+HyzUHRVfHDwfRzm5kzDquV9KTM3MT0QowV YE+WCFGydfEzXNA9VhoNGUGISh7CpZcDv5lGwF2bZ9mXFJje1qluL9phW2BV41MSpvgC 7Pija3bICetehKrFXwbVNh6Hz9kveuBQnEUgae40RXy6asHVjispaA3U9rrSFgq+VYW9 Ss8g10SCsNDtt3t6aTujUfHUPXpZ3N4MgaEsN3uWg6iHS8HBRAma66tz4PgQ3dvMo6HI HV1Kwg2DngLx4Yar6h3Snhw+mIWXEFyo4FoahHxILeEjbM5CUI9Ay5n1rlFd3u9HIJBd MLkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HiPDTYhp; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-1766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t20-20020a639554000000b005c658bf30aasi11540411pgn.412.2024.01.31.22.04.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 22:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-1766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HiPDTYhp; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-crypto+bounces-1766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1580BB2703E for ; Thu, 1 Feb 2024 05:49:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5811778689; Thu, 1 Feb 2024 05:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HiPDTYhp" X-Original-To: linux-crypto@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAC4E7D3F1 for ; Thu, 1 Feb 2024 05:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766569; cv=none; b=S8cskmLi49wX8dO5I7cn/d2N2fw/w+Dyj5BOS8fb1yOW24X/3cchQa/4SAYkJNTL+s+5bG6NW9H3YulR74qguylFbEKYIJbLzhuDIXpyn6w05f2VByCRdhdy9XsjDdIj8t+tA1orDm0JJYEw19zqKn082lfiQi1UmGGf7XEJWBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766569; c=relaxed/simple; bh=KIExdWHVmutlvlT3+obd3h+YUc2wXhpfig1qUZ2NMOI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LxrSQheTygQ4KvUf3MAVuZpF2qavb+SHnPwciKwwJKnU/6QWAHrUOSOQD0FRLX+XuR2NsTaXmptD5577gWCp+5muYhQqRd3aHiZzOCsUj92tbcyNTx9KhgcMpqSoubViIACOYFuZTvg1aOV2Wz7DPQD3qw2TTzYPbB2zfiZGDWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HiPDTYhp; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706766565; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgbdx/AAaJZ7DeK9FOsHQhtQNYQ6A6a2HZZVAxKhKQQ=; b=HiPDTYhprKnOWm+9bzsnARnRuH4JvfeSrCVd4enMfyaQCzY2ajqJiYcJmrcG0cIVEBN63Y GT9jeJE0bjEuwQmRZI0RzzpBd1PjYwA3viS+uyMaSaX1aWMmaJwWWVVj9Hoxh4Wqo5SBSq fnL5Y/x7vMVkdQFIf+pMU6zbtvKjHTg= Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-OOSIk1ZQN863vTL1JqRgiw-1; Thu, 01 Feb 2024 00:49:24 -0500 X-MC-Unique: OOSIk1ZQN863vTL1JqRgiw-1 Received: by mail-oi1-f198.google.com with SMTP id 5614622812f47-3be76c32883so528998b6e.2 for ; Wed, 31 Jan 2024 21:49:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706766563; x=1707371363; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jgbdx/AAaJZ7DeK9FOsHQhtQNYQ6A6a2HZZVAxKhKQQ=; b=Iku/IcmgA8q2nLQsSRTHLDV1OKyBwnLuhktonM5S0Ka3NoGIFdMpIbvB5R093QJYqs Oaq2ixFv386VV2RF207/Yp3WN680cvhg3iGr7rhAKekC5az92zxO6l8u+ayb+EjscJ2O 0V9IJMLi+FGvmY9B8AU2eHpm9NY7sG5BqRUN0CRRURSQqmI68eu8RiQ3ybgsELzwVDgF rtgNpzR29qF5k9C0CLfMBCcGrqPft9qNdaAfh9SIWT0NPslgwV19pWWrwrz6Vlcy0lHw AS9evO8ilypJ+FiJhpT5nevt1+pKEWM51xZKbLHC/jGknj/Iv6x4Ij/5oyd8Jwqn99QB WrEg== X-Gm-Message-State: AOJu0YxabouLucrIN8VnuyKWYeulG1O49i6rQvuYA9yEynboZZC4uxco 7cJq+YhJT7GU8Ye+3IXS00bJqxA2n9xNUnj11jEenzhhU+fEDNc8pMcTYSwQ9OkN0DSN3kT4vxE VOLN2gmJnXkUvK94Wc3qF+ya+eLhIps9irJuo23CMKK5QwpHU/1TYdgiuO0Lb4e/9vpBNHiWnkU EZZR/gvozwbUaVm6dCHsld86JoVNN5W3SeXLPE X-Received: by 2002:a05:6808:3092:b0:3be:37ff:47d5 with SMTP id bl18-20020a056808309200b003be37ff47d5mr4229264oib.32.1706766563547; Wed, 31 Jan 2024 21:49:23 -0800 (PST) X-Received: by 2002:a05:6808:3092:b0:3be:37ff:47d5 with SMTP id bl18-20020a056808309200b003be37ff47d5mr4229249oib.32.1706766563285; Wed, 31 Jan 2024 21:49:23 -0800 (PST) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240130112740.882183-1-pizhenwei@bytedance.com> In-Reply-To: <20240130112740.882183-1-pizhenwei@bytedance.com> From: Jason Wang Date: Thu, 1 Feb 2024 13:49:11 +0800 Message-ID: Subject: Re: [PATCH] crypto: virtio/akcipher - Fix stack overflow on memcpy To: zhenwei pi Cc: arei.gonglei@huawei.com, mst@redhat.com, herbert@gondor.apana.org.au, xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev, nathan@kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 30, 2024 at 7:28=E2=80=AFPM zhenwei pi wrote: > > sizeof(struct virtio_crypto_akcipher_session_para) is less than > sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from > stack variable leads stack overflow. Clang reports this issue by > commands: > make -j CC=3Dclang-14 mrproper >/dev/null 2>&1 > make -j O=3D/tmp/crypto-build CC=3Dclang-14 allmodconfig >/dev/null 2>&1 > make -j O=3D/tmp/crypto-build W=3D1 CC=3Dclang-14 drivers/crypto/virtio/ > virtio_crypto_akcipher_algs.o > > Fixes: 59ca6c93387d ("virtio-crypto: implement RSA algorithm") > Link: https://lore.kernel.org/all/0a194a79-e3a3-45e7-be98-83abd3e1cb7e@ro= eck-us.net/ > Signed-off-by: zhenwei pi Acked-by: Jason Wang Thanks