Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1556544ybv; Thu, 6 Feb 2020 06:06:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwo8c02UVuIvRX99IofiN1rEaepafSGI1tNTsOYrnTnS5jOoKjEYpuIyIjkUrgcPji6SscL X-Received: by 2002:aca:f587:: with SMTP id t129mr6681948oih.143.1580997982586; Thu, 06 Feb 2020 06:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580997982; cv=none; d=google.com; s=arc-20160816; b=p8VI4UnL6VeQaAvOXUlQ7bEeI/awNPPGKAQuvivsVRlHTc1RVUOiyc2eSKs7pIo2Z7 5B3c19mCfUChCpgktp8TkU/iqnOivvCjaUXJ23CdjORxkL5d1ySc2zItCBgy4gqAuEcU PZARs1HhHTJi9kqXVfSsMVWNOB7nrjIQvw0cqwzIgoKsvjD/PIbJ+5oXwczb6wH40t0T IsbYAivJv51JuOau/CgL/YU+/SFlMqw7IvlqLS/7yDsu4t4E8ELRKDfrd5xUB8lFcaIY b/2g5lq2pGqRbhKXbiZPe32eVW8i2IvR+STXX6OD/A/91yEgCe0o3KO0qI/wUW75BtXO XFAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l3dSs9JJWDrZzkDc9n6Hxfa0vrCSBaESt/sYufaXU0c=; b=P7O+Bmp8E9qeBSeRBuI+FOQTPmbvyGfOvCBZeaU8Ku2VsfO7t3AuNUnEf1JrUdWyYZ 3MMWwRsoLJEBkw+kP0VagSUw1G46GYtSdnJRFv1PTFOOenD8MOc48qMogObVHUVIcss5 Wz0hqwhvEgu3m1NIT19DdrTupDZPVZw9e7s5bBUXmaQRukWSKGiX8ZI07Esag8T+O001 SLSEw+UfmtBhwv4KvdhVo76Vrs47u+dCrId0WH0ggO0AZG5Zk9sLt5vz4FcjmVfytiQI NxLtFj6R/Enm+OensyTx32uxdthg5HUvJTNRusmC0IxRSiGlBi4duvPhib9Zdqtm3hON tAaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BHH4yM50; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si1867902otp.20.2020.02.06.06.06.04; Thu, 06 Feb 2020 06:06:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BHH4yM50; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727872AbgBFODu (ORCPT + 99 others); Thu, 6 Feb 2020 09:03:50 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:38332 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbgBFODu (ORCPT ); Thu, 6 Feb 2020 09:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=l3dSs9JJWDrZzkDc9n6Hxfa0vrCSBaESt/sYufaXU0c=; b=BHH4yM50LhLkmL/Hg+7EncUPvP C6sZuWPCYUCf+fVyhjNTPykwmZc+D8OSqJezFNjSkS0U8pcCzlh8n7065y5ZCLyRzO3lXO2OaXWKb YHOPR9trqnBETcrS1PrkrKWNdDNug29tkdeoK7dOzCpAd/Ve1e4m8Pn2VMukOR5FlWCWXbbo56oe+ 1lYDElEd9JwnEFr05EJBf+FZ86hE4zocfiFl4d5jJ2XVn5e9dKPMLchvHygl1boQfNtv7ejJ9r44W 7bnYVkxWrd6+hLWW0GVtUveiQnMVZ72oxWCZZb/ow1jVB28yRfu5sjJaciZuMP2VLBplbznVHinV3 8fU2p8mA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1izhki-0003L1-1Z; Thu, 06 Feb 2020 14:03:32 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1C0653007F2; Thu, 6 Feb 2020 15:01:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 77A482B76D3B4; Thu, 6 Feb 2020 15:03:29 +0100 (CET) Date: Thu, 6 Feb 2020 15:03:29 +0100 From: Peter Zijlstra To: Johannes Weiner Cc: Suren Baghdasaryan , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH] psi: Fix OOB write when writing 0 bytes to psi files Message-ID: <20200206140329.GX14879@hirez.programming.kicks-ass.net> References: <20200203212216.7076-1-surenb@google.com> <20200204185523.GC9027@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200204185523.GC9027@cmpxchg.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 04, 2020 at 01:55:23PM -0500, Johannes Weiner wrote: > On Mon, Feb 03, 2020 at 01:22:16PM -0800, Suren Baghdasaryan wrote: > > Issuing write() with count parameter set to 0 on any file under > > /proc/pressure/ will cause an OOB write because of the access to > > buf[buf_size-1] when NUL-termination is performed. Fix this by checking > > for buf_size to be non-zero. > > > > Signed-off-by: Suren Baghdasaryan > > Acked-by: Johannes Weiner Thanks!