Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1998440pxa; Thu, 6 Aug 2020 23:48:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHkrA/UPbDnaItdE44r1WL0YfDbO65KtvLj4sMhU09s068wXxVEBsJ1/KEjTVxMZWb4bPS X-Received: by 2002:a17:906:25d0:: with SMTP id n16mr7522174ejb.306.1596782908573; Thu, 06 Aug 2020 23:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596782908; cv=none; d=google.com; s=arc-20160816; b=kFPkEa1HsQCifySdQ9HzhYNWNiBBLrEOgm7RojDv5kqym3u7HQSI7ie0jQqpI0i4zK R0263KfVFATrt+iX7+50qxmDw3OvK7x+g9ZRMVPMECztkLekiSdjTnEbzMufS4opkjP3 NL3eP9G0nHpSBg38t5qe4wKHn6+/dM8W6XnO3QJ4PsRjzlDoiZGvxqndQrfToEotA9Tp si5nL8VFsOvmwLQWU0R5zpy/IPe3+3tqw6cDl2XAO+5jedskaaYXOdR3pyrQxAh9EVIK /PX/2b1kkDY+ginOb0/d2A5n8PebXX4EajHbBefz1cERO0I0U1UGjafpeNECF2f2iCGE fQtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SqxXmUiK7bEJla9DM38sBEbKa6Nq9LJxsuptDBfN6kE=; b=nDfWJaCdKwnqZerAKj1ovEIGulpnnbiimUJmO5YaO9j7rdtLiBkkRauHAahWEVMeYD 4XXRe4HyQhVHyuR/4cg7iAVd80A4wi8H6F7DM/YLi37tPvyFEYUx9moz7Knvkl8yXjki OvPpo8xOXKolJj4u3qOk0t7NrYJKJfva+RPDmyHc5dGKqj0+/60cwuVYWFKznaZWvdZo o0c+AWauQSqIClBXuOO5a3whq9lqvdzz2HHOs0OG1K44VB+sl/ByARPctXVljXIDlaIw ZKD664HnWtDuKcW+qxDQvQIlYdhMh7IQiUBP+VH9nDuGph1K7KHPXoJB+9Hx5jQLH94m m9xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NtjyCGcI; 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 fx19si4590904ejb.691.2020.08.06.23.48.04; Thu, 06 Aug 2020 23:48:28 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=NtjyCGcI; 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 S1726212AbgHGGre (ORCPT + 99 others); Fri, 7 Aug 2020 02:47:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbgHGGre (ORCPT ); Fri, 7 Aug 2020 02:47:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 002BE20866; Fri, 7 Aug 2020 06:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596782852; bh=SqxXmUiK7bEJla9DM38sBEbKa6Nq9LJxsuptDBfN6kE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NtjyCGcIEP9AXhfIM3EG4BPCtXhgO8DRQUKxnQDB9dOVTSYff71OVVO9yoqHpuJc7 oznteTT5V+qeKzOd6GrgoxH9iaXxDzUl3zGm0bWeyZBs0Y0TBPleciknAqoYPjm+Hq gNFpNdoG03LTULJs9HowQlVUi2i0eQTMWzD9Mclo= Date: Fri, 7 Aug 2020 08:47:29 +0200 From: Greg Kroah-Hartman To: Kees Cook Cc: linux-kernel@vger.kernel.org, kernel test robot , stable@vger.kernel.org, Jessica Yu , Shuah Khan , Masahiro Yamada , linux-kselftest@vger.kernel.org Subject: Re: [PATCH 1/2] module: Correctly truncate sysfs sections output Message-ID: <20200807064729.GA981993@kroah.com> References: <20200807063539.2620154-1-keescook@chromium.org> <20200807063539.2620154-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807063539.2620154-2-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 11:35:38PM -0700, Kees Cook wrote: > The only-root-readable /sys/module/$module/sections/$section files > did not truncate their output to the available buffer size. While most > paths into the kernfs read handlers end up using PAGE_SIZE buffers, > it's possible to get there through other paths (e.g. splice, sendfile). > Actually limit the output to the "count" passed into the read function, > and report it back correctly. *sigh* Ugh, never thought about that... Reviewed-by: Greg Kroah-Hartman