Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp274347pxf; Wed, 17 Mar 2021 05:10:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoJIKEkg21+g++nGP7CNUjnW/hI9AQMxoqqytB1c1AJazrBvyrEVB2FdQA/ykD/iULXNpo X-Received: by 2002:aa7:dd97:: with SMTP id g23mr41197648edv.154.1615983034173; Wed, 17 Mar 2021 05:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615983034; cv=none; d=google.com; s=arc-20160816; b=iDpRrub1I0pVNMlD3DSl4qey3DCHw+QDFaVdTovahMKSsTvAKkm4oPcDW6FdIwQuUa 7L3ALkVocav5x8en9f+SEnWFx0GVwoQN/TeAUJZkpxxvTL8NwmNG95785DZX3hxbW0XA b56/y2/0oK/FXwqaUxiXWis5wJgVhtJStoSm1cQqaBRvfND5CyeeYGUNqUyAdZ/kym5A r4SC44W99iV15V4PuMVJIuotz3SuM2bPiXccQ5kXSza2TPYzOrhx58z8oDgY4Dn6+ssQ wR3VGw1kaoJmnZv4zqJtvK2VvCDLA/0tlGalcgrtA4jWh1JpFcGHaLj9XxOyriEWFO5s LgOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EzSShNBc+a8YeE9Atm1rFDpCfXSt5KJELlWzCgJ3hd8=; b=FHVAFyyB9djIP5CGZnG2f9WlwInUZ0tew/yLhPmvJUCFFrQ4vg9zzrBdpOJWGC0R1o FerX8vJHOx8/MksHNOkDjdle5B70itf1HM34P0KyOXQRPHkeGi1Ne+7NYTbCLZcwlmiT h8NVyHhCje6yEuXAByT2Ro7TX8059oGTN8WzKxFbpyZR0xJd/W5mLPLn0calky0e1vpc rfnlOViSluHcbqSIzWOwEfaVfg2eLpl+u1VSe3XP4aKpyAffZbCx3ZDOgEmzPAsbUD9I y8gm6uypFIv+IBQkUu0Mr/fcRYJi0Lr3L6MAkZqGpvzUbUFGDsOIv/eFIrVkSy2EVTPV BCVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=GAAR2fNv; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go18si16191973ejc.187.2021.03.17.05.09.55; Wed, 17 Mar 2021 05:10:34 -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=@suse.com header.s=susede1 header.b=GAAR2fNv; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbhCQMIa (ORCPT + 99 others); Wed, 17 Mar 2021 08:08:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:35618 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231590AbhCQMIY (ORCPT ); Wed, 17 Mar 2021 08:08:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615982903; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EzSShNBc+a8YeE9Atm1rFDpCfXSt5KJELlWzCgJ3hd8=; b=GAAR2fNv7ycSCNW1tT0QHZbrZLE2FXxmr44WsCufiP+c3d5rB0ODeb0DBCIgJ3m8GNK7Vo bKs4zX6qm8UjHUASqpC1g1dULhYe1dRCoLhu96z1xXCESHBTCN1QzaJ2sso2O+1xsqB63k ymNyrupM0xSCu+tnr2lhk9xuqvB1MAU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 62407AC24; Wed, 17 Mar 2021 12:08:23 +0000 (UTC) Date: Wed, 17 Mar 2021 13:08:21 +0100 From: Michal Hocko To: Kees Cook Cc: Andrew Morton , Greg Kroah-Hartman , Alexey Dobriyan , Lee Duncan , Chris Leech , Adam Nichols , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org, Uladzislau Rezki Subject: Re: [PATCH v2] seq_file: Unconditionally use vmalloc for buffer Message-ID: References: <20210315174851.622228-1-keescook@chromium.org> <202103161205.B2181BDE38@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103161205.B2181BDE38@keescook> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 16-03-21 12:08:02, Kees Cook wrote: > On Tue, Mar 16, 2021 at 09:31:23AM +0100, Michal Hocko wrote: [...] > > Also this cannot really be done for configurations with a very limited > > vmalloc space (32b for example). Those systems are more and more rare > > but you shouldn't really allow userspace to deplete the vmalloc space. > > This sounds like two objections: > - 32b has a small vmalloc space > - userspace shouldn't allow depletion of vmalloc space > > I'd be happy to make this 64b only. For the latter, I would imagine > there are other vmalloc-exposed-to-userspace cases, but yes, this would > be much more direct. Is that a problem in practice? vmalloc space shouldn't be a problem for 64b systems but I am not sure how does vmalloc scale with many small allocations. There were some changes by Uladzislau who might give us more insight (CCed). > > I would be also curious to see how vmalloc scales with huge number of > > single page allocations which would be easy to trigger with this patch. > > Right -- what the best way to measure this (and what would be "too > much")? Proc is used quite heavily for all sorts of monitoring so I would be worried about a noticeable slow down. Btw. I still have problems with the approach. seq_file is intended to provide safe way to dump values to the userspace. Sacrificing performance just because of some abuser seems like a wrong way to go as Al pointed out earlier. Can we simply stop the abuse and disallow to manipulate the buffer directly? I do realize this might be more tricky for reasons mentioned in other emails but this is definitely worth doing. -- Michal Hocko SUSE Labs