Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2015240pxk; Mon, 14 Sep 2020 02:22:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDR9+b7uhZ7hsAOXZJKN9H9Y1S0cg3BL7w46XY0Wp3n4J5ip0L14BqVOCNgVR7QcpYEyy1 X-Received: by 2002:a17:906:cb94:: with SMTP id mf20mr14321320ejb.8.1600075320234; Mon, 14 Sep 2020 02:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600075320; cv=none; d=google.com; s=arc-20160816; b=rr95DMmrI29I4av08YyyqAoZubQ01fUyIQCgBiIakDjvpkLNiFqGwPT81GVz1LkVzz Z7EgJDUYQ5CP1vcZQOJ3evs0gSPRET5TDFO2Ly+VL46/KZwW8wlLTNSTmIuwRAi8d8jI XkyOojbifitBN6y5pc+UlHHa6Z2bw3z6pWQyAm8zjTdWN3t66ou5h1KuPeROLie34T8y 4Pmdp38XmuyQcNSaiR4GnVxJTPWCQQgFL7ye1bHTujT2KDqton6QbEdLdCVo/ydPiDHS CoFYBiGnY+GQ4NlHrHpaBQsnUiOScKaufI67TmgxRikpnNz3JIVA5NisbrBjrsI6MM8W Jcqg== 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; bh=PFZ3gthKiLSvQXRbY7xVbivK3vrf8desZkueo/tguhA=; b=Ar4IYRexLlIat0o2j1omswerP40uR+LNKwusB6dJQgfZxJpVzd06KAW1Tj59KLLWTi eKWg/JAS1EtEe1CVgd8iTszw0cYpuX1IWrDReDUvYC2BGxijKrILxibmJq2bLZf1LLkv ylbkpJyFTnt6tm0ocbu/qjVDbMOMAnJZS7mgpTkuychvzdm6wX/lpxZyZ0GUDwcdxcvc AQbTgMFY1kGRv3vah5yerTNMBnhS5KjKB3Ag28R3R0noYKqTTSGTcU4lPMhwT/jWvPXq aP+2g2u5ljJefxcuGmQKboYyVGHWvD5TqAe4kw/MX9gib6kmjQfZLpInESd5QrEY4Zar a3/A== 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 v3si6233911ejx.520.2020.09.14.02.21.38; Mon, 14 Sep 2020 02:22:00 -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; 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 S1726275AbgINJSr (ORCPT + 99 others); Mon, 14 Sep 2020 05:18:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:54652 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgINJSr (ORCPT ); Mon, 14 Sep 2020 05:18:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B9090ADC2; Mon, 14 Sep 2020 09:19:00 +0000 (UTC) Date: Mon, 14 Sep 2020 11:18:44 +0200 From: Michal Hocko To: Muchun Song Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Cgroups , Linux Memory Management List , LKML Subject: Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format Message-ID: <20200914091844.GE16999@dhcp22.suse.cz> References: <20200912155100.25578-1-songmuchun@bytedance.com> <20200912174241.eeaa771755915f27babf9322@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 14-09-20 12:02:33, Muchun Song wrote: > On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton wrote: > > > > On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song wrote: > > > > > The memory_stat_format() returns a format string, but the return buf > > > may not including the trailing '\0'. So the users may read the buf > > > out of bounds. > > > > That sounds serious. Is a cc:stable appropriate? > > > > Yeah, I think we should cc:stable. Is this a real problem? The buffer should contain 36 lines which makes it more than 100B per line. I strongly suspect we are not able to use that storage up. -- Michal Hocko SUSE Labs