Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5278580ybl; Tue, 4 Feb 2020 10:56:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwm+y8jrSxoprIttN730QAplpgTdK2zT+PtAXOzUoULAjW+UTOKlF4dc+mCz5wH2OIvL/op X-Received: by 2002:a05:6808:24e:: with SMTP id m14mr308229oie.168.1580842597471; Tue, 04 Feb 2020 10:56:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580842597; cv=none; d=google.com; s=arc-20160816; b=RZvWSiylYhrTIYgAlK59ohXmwfY3QfvIBGrWEESA4N6GA9d4kw3B/nQY6FTSqTXEVo XXEenN8fPhEPkfh1/FgiF7DjFlQOAfPN3IRv9e54oxEvfwUWTv4knYPw07Tmtc+SSrjP vWdJFsdbFhYPb/QKz1MEcrHNJ150d5vgZqcF3aAS08mJCQP+jxE+mGxD4MsTyr1FIpib dk2vDsg2nmI3JdRr4BLFNmjRuUcbL6PQUEYLfDm78G1PBdkFgnmbbMd35VbZCj67JuXO RZdg61soNzLu3M1CAQDiYWfT/bj3Y+FsO4GF8Tt4nDyh6Ki/d6tFyrovBt6BpzyUp5W9 wvIQ== 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=DKe72S+VluXSCZ29PD9XHCSnv/QjEL3zPcDFXshWPUw=; b=MV7FW7nRRaQarX3qavrOMb/91+1SaeGym8eN5tDHRG/TioKFJIqiz0ORveOi/l2Y3y Je9D28U4JURdNx9AilDnBEZEUdrK/FQlTIE5v3B810pNoVEB9zMuuLhmHVQ8hfIxMtmT TPBnGR2SjITanKcPGi2uyXdRNaT75wx52PyujXuvDO5NRKDpysRxTkLR0oRwEd6ymmpV aMK7PB8EsV1oUv9PrcN/Opew+8mkjPsmUW62bx81C2hL5NHB1GfSnBihpDrnMw1xlUeP vREQrKTo6wKT6gEHeONd2aCRG3Y4UzVf9p+R1vYKvXSwJ+tIu6X+o/6roLuijfaCAlF2 0Y0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=v0LrEskK; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si11967628otq.31.2020.02.04.10.56.23; Tue, 04 Feb 2020 10:56:37 -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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=v0LrEskK; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbgBDSza (ORCPT + 99 others); Tue, 4 Feb 2020 13:55:30 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:46678 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727314AbgBDSza (ORCPT ); Tue, 4 Feb 2020 13:55:30 -0500 Received: by mail-qk1-f193.google.com with SMTP id g195so19004749qke.13 for ; Tue, 04 Feb 2020 10:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DKe72S+VluXSCZ29PD9XHCSnv/QjEL3zPcDFXshWPUw=; b=v0LrEskKg/nWdHwgB+hV5I+k4ySmZ3vRd+SrZeLqSjZEP3ZLka8vOr3He6SRg0nmoC GX1DivbnZexrz5+6z5YUUNkXgk9yre+qig4gt6TLHysClSG1BrQHNAw+7WLNzpy1dfJr aT66fFItBhHz6FaavZpGAJ7z1A+hHYeqC9SEUTYB9qum6DItbyCAUgdKdeAE8XRywO1m 0iWnktP7vZFSdF3B6yP2J2WsWtDlG8shAqtllLn9YecG/y6cVsW1LD7mM0oLpWnDYJ6q L6qnCWjNSVunzkHct3KY/M9XqiuAeC6LBRXNcw/q2Xv5P0KmjqQbkxOmR+tMmhOPKTTg hEIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DKe72S+VluXSCZ29PD9XHCSnv/QjEL3zPcDFXshWPUw=; b=Qde00fZRsv4qg2/McwXcDpZHz2Gpw/N93FwzuTNpbptSNn5G81vOMTgDzHc/GYHoNe L7Ee3w9AZeVmiOlo9H2bVEXuMWdsPjSB2CDn3EqH9/STPt5rpzBUYtnqopU4Tg3K8TGl KaMuOWMb/K2q7mRG+5qvdA1NHNC76u9ZmMKsUPjJeFk/0bYimSXYPd8Ysx6hawW7krb1 oClxU0g+Jb4g+lmxuZxM0FaiUa/yd31YnjT+0i4XRSmTLZByfJ3rr8+unhqYGZh/56JP kD9htxHdrnDyb6E0btT1JKf+e1bS2iJN6NafNi82O9pHIdtAuSEdXwOovn3xyfSe77EZ vm7Q== X-Gm-Message-State: APjAAAWzcntIF1VwOnOKCCYcIAA6PczVdVAvFtg/N+noKxXUwkFf+gJx ojmNmmYoPR4iKhCy8MlI0qyWrw== X-Received: by 2002:a05:620a:20d9:: with SMTP id f25mr3208051qka.375.1580842524610; Tue, 04 Feb 2020 10:55:24 -0800 (PST) Received: from localhost ([2620:10d:c091:500::bcd8]) by smtp.gmail.com with ESMTPSA id q5sm11504592qkf.14.2020.02.04.10.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 10:55:24 -0800 (PST) Date: Tue, 4 Feb 2020 13:55:23 -0500 From: Johannes Weiner To: Suren Baghdasaryan Cc: mingo@redhat.com, peterz@infradead.org, 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: <20200204185523.GC9027@cmpxchg.org> References: <20200203212216.7076-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200203212216.7076-1-surenb@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Suren.