Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1575543pxu; Thu, 17 Dec 2020 13:18:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6q4565G08OxOL7IJhIAc36F9zGj4/G90WDed5+r5u5blMp3onUImUnnKquazQvQqajLcK X-Received: by 2002:a17:907:414c:: with SMTP id od20mr931355ejb.75.1608239929729; Thu, 17 Dec 2020 13:18:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608239929; cv=none; d=google.com; s=arc-20160816; b=nT+ScnY65wHEDqDN5p/EsbVMK9uiEueUrA1D3Ek7nk8Xtwiu1Rk/zRZfuUjUXEAGNT HsBczCAMHkP+iFcWvIGf8uydpG4ZLcgRGXlW/eEHqNUlb91WNCImBN+aIZvnorX68FFk 5yLGCPynPMdQqpXx1QYx/1DqIwhy9tMMxaPcDQmlHyqfrqVgnzzuRYszxEKm0wmvaVAI dMJGxKsBU0E+OjhktFjFdt7M0G2mKL5CXe4uybePTqVZFxfZGQzFxJXIlDyTcgzQoe6d 8ZLLnhQ9dgllbKXeawur/S4is7lAqvcZq/e2Cwc+cM8rJ3ZI3pHD0LYGW4ONBgoBHcUG Za7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=zHu3afiBPKHGIi8/ESO34BfKHEUOWbj2Gqp03/+t72k=; b=dP/nIOKJxz9pDuDYPPCvK2q4LTR/zeWiqcqQbIX25kHPAKsuEPQS85uDBqktWeGOKe qgH3pALHKiIKiEqmN7mYU/O1Ssyyhpz674poc3YjTa48fn6mczoUmjx5mYZ6+sg5DxqA dpKELMYmp0nlT1x0nufOrXOJyt7Ks7X3Wnv8kuppXqLjKQqvGJJ8pxjSg1A+4PnmDdSy iiLjT+yl/9xrLMWXcZbvRwpH//iJXPfrbi8XawtRLrAKbsra3pGRdVl6K/+mLcbmL3W9 2SVHTdAyQiblJMFHdl7kbDek64nX7mMjmzcLMAUv/KKJjpE89BejnUASxMzBrexkR3Ku K7PA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si3374021ejd.342.2020.12.17.13.18.27; Thu, 17 Dec 2020 13:18:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728204AbgLQVQI convert rfc822-to-8bit (ORCPT + 99 others); Thu, 17 Dec 2020 16:16:08 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:54824 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbgLQVQH (ORCPT ); Thu, 17 Dec 2020 16:16:07 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 09F33607400C; Thu, 17 Dec 2020 22:15:25 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id hByukZsLW-RK; Thu, 17 Dec 2020 22:15:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id A7B15607400D; Thu, 17 Dec 2020 22:15:24 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QUqGYIv__iVP; Thu, 17 Dec 2020 22:15:24 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 857C7607400C; Thu, 17 Dec 2020 22:15:24 +0100 (CET) Date: Thu, 17 Dec 2020 22:15:24 +0100 (CET) From: Richard Weinberger To: Andreas Dilger Cc: tytso , linux-ext4 , linux-kernel Message-ID: <1954206563.139982.1608239724384.JavaMail.zimbra@nod.at> In-Reply-To: References: <20201201151301.22025-1-richard@nod.at> Subject: Re: [PATCH] ext4: Don't leak old mountpoint samples MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF78 (Linux)/8.8.12_GA_3809) Thread-Topic: ext4: Don't leak old mountpoint samples Thread-Index: 5/agPCILI9+Z5tj3UF1N6yN+vCIJ5Q== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Ursprüngliche Mail ----- >> Fix this by using strncpy() instead of strlcpy(). The superblock >> field is defined to be a fixed-size char array, and it is already >> marked using __nonstring in fs/ext4/ext4.h. The consumer of the field >> in e2fsprogs already assumes that in the case of a 64+ byte mount >> path, that s_last_mounted will not be NUL terminated. >> >> Reported-by: Richard Weinberger >> Signed-off-by: Theodore Ts'o > > Color me confused, but I don't see how this change makes any difference? > If "cp" is only "/" then it will *still* not overwrite "edia/johnjdeveloper" > at the end of the s_last_mounted array. To my mind, the only difference > between using strlcpy() and strncpy() would be whether the last byte in > the array can be used or not, but doesn't affect the remaining bytes. strncpy() zeros all remaining bytes. Thanks, //richard