Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3407643rwd; Mon, 22 May 2023 13:18:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XcqzzQtrG9+AuNIGvBZ+PsOsto8YppSCbxRD8iCEy+mVIIfcRv9jgh+kQNmHNSZZ5Ctpr X-Received: by 2002:a05:6a20:72a7:b0:10c:38d3:437c with SMTP id o39-20020a056a2072a700b0010c38d3437cmr1645780pzk.58.1684786702540; Mon, 22 May 2023 13:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684786702; cv=none; d=google.com; s=arc-20160816; b=cOyexnuoBEPhdrMiBulct+E7At79dU+//JlI6Zlq38btbCr6ekmXTNLaA6Xt+Bcg1/ pRWzlq1NcZuuh2W0wzvWvHOnDGWhCpqYO/L2YUW8VIpSJTr0FQRxDQ0p/NbJ+7XCskym sJzmrpup0tdVFp34qwkSdafHd67enjZ2vbJ2hmH+3LtFPmjaqGIu8f5HGjr0yogwFCmL z3r2ladkburz6ZGsUaxo215YH/JxQFnodCs+meQybeLHEn9o/V2/X2Ow7Kt/0XOThAM4 mUz/4wlUNRQsUn6LWcEpjqmVRJhDO9qUa9oZg1x4iSQXN0Oy4YWPVpZuJS68VnYvBfLS M78Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XZNUaQE6VKvjsh7xrkuV4v8D0r55eKxWvK+t0uMsFI8=; b=Nr3+R6vYhVccptzA1N0w84aH2aABQg0ZGmUbq1aunj/sYzW/hW8aL0Kchk/uR8Hhc0 jn593akDg/QAr6lA8B4HV8eqTeeG/BWFyE51nEVQzIwOJ+pxBH6nP1XtuPbiPWCRi+Q+ Q7uiLwJe2CC3Ysrp14wB5DCed37rKtMY8fAmWKZZk5NBC3qRydihGxBb4ae5PMiNEK2T StJVlb31n+Rq9m41qR14osk5RDDUO4ArumKNXu/+xo4FBzZ6qGI0JFUt0VyDQScK4Luo yHcudGLv2OfGMcIuGTRGAMRXiHkVzkeNSiWbfgEDwebZBDWY37OsLkHx65+dJj7qH1dt 1skw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="YvKTLXk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f188-20020a6251c5000000b006262bc88219si812204pfb.160.2023.05.22.13.17.51; Mon, 22 May 2023 13:18:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@chromium.org header.s=google header.b="YvKTLXk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235145AbjEVTkd (ORCPT + 99 others); Mon, 22 May 2023 15:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbjEVTkA (ORCPT ); Mon, 22 May 2023 15:40:00 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFBD7196 for ; Mon, 22 May 2023 12:39:52 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2553b0938a9so1605469a91.0 for ; Mon, 22 May 2023 12:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684784392; x=1687376392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XZNUaQE6VKvjsh7xrkuV4v8D0r55eKxWvK+t0uMsFI8=; b=YvKTLXk/IIa+97neDHvl1q9LrImkclAS+7j5d1vJg/hULvqmkzL/+Gq7nFxGecAH4C S6V1QO38N/GeSXFB06FEG2Au6/J5Mytjp5dmRPvcR0YzaAISMnjgVwAIcr6iRSKIxmQN QJFbmzXyfCR8EYdbyUhTYU0Hk0FCh6i56f560= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684784392; x=1687376392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XZNUaQE6VKvjsh7xrkuV4v8D0r55eKxWvK+t0uMsFI8=; b=AL5n28qRXQ9BtH7l0Y/QPcBQkW5UokqDpngPeaOZU//Yl2ooV9QBSBRp/1iZv0sXzC Df66hKERXP1LWDXCKduM6V5vlaFrQySYYhDpOGAdp5QzQS0anDSwJTznJ8Ks7zQdNF1k d2cjRfXOw096xHMrTUPd1fPjVHKLmKMLArsnH8UYcMkxBN8x4+qQyHWFh3sVTjNT1mI9 sEUaU+0wU2BY8ahGlqmPaY7htDc6KMNJ2Zg1Nhy1dWKoZinvRcYvKzwSZdjpruvNFqNM E4X1NadLaAF+WXCsk+i50F8BVRg/6eZmYH7GgU3YYu+RlA3d0P+rf6OFxx1c7mNxLF1B NLzQ== X-Gm-Message-State: AC+VfDwVgZBpvmRu3U8pqBxf+nEkRAAkZGBNtERflqhsJe9qDQ0Vcvrq YISQqmtOuLqR0YBlDCTvKBpA9Q== X-Received: by 2002:a17:90a:9f8b:b0:255:6ea7:7041 with SMTP id o11-20020a17090a9f8b00b002556ea77041mr3720184pjp.41.1684784391898; Mon, 22 May 2023 12:39:51 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id gt18-20020a17090af2d200b0024df6bbf5d8sm4484416pjb.30.2023.05.22.12.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 12:39:49 -0700 (PDT) From: Kees Cook To: hdegoede@redhat.com, azeemshaikh38@gmail.com Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] vboxsf: Replace all non-returning strlcpy with strscpy Date: Mon, 22 May 2023 12:39:43 -0700 Message-Id: <168478437621.244538.1202856406180337699.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230510211146.3486600-1-azeemshaikh38@gmail.com> References: <20230510211146.3486600-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-kernel@vger.kernel.org On Wed, 10 May 2023 21:11:46 +0000, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first. > This read may exceed the destination size limit. > This is both inefficient and can lead to linear read > overflows if a source string is not NUL-terminated [1]. > In an effort to remove strlcpy() completely [2], replace > strlcpy() here with strscpy(). > No return values were used, so direct replacement is safe. > > [...] Applied to for-next/hardening, thanks! [1/1] vboxsf: Replace all non-returning strlcpy with strscpy https://git.kernel.org/kees/c/883f8fe87686 -- Kees Cook