From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F25EFC4338F for ; Tue, 27 Jul 2021 07:38:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8B7F261042 for ; Tue, 27 Jul 2021 07:38:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8B7F261042 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 134146B0036; Tue, 27 Jul 2021 03:38:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E3FB6B005D; Tue, 27 Jul 2021 03:38:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F14156B006C; Tue, 27 Jul 2021 03:38:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id DA2186B0036 for ; Tue, 27 Jul 2021 03:38:20 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 763CF8249980 for ; Tue, 27 Jul 2021 07:38:20 +0000 (UTC) X-FDA: 78407564760.29.F2BD17C Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf05.hostedemail.com (Postfix) with ESMTP id E02A95033E02 for ; Tue, 27 Jul 2021 07:38:19 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8E504200D1; Tue, 27 Jul 2021 07:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1627371498; 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=CgiQRPkDgLjaPWkkjWQpseQ0PaT2bHgPDPuLTNdvcZ8=; b=uoReRIZUx4hStU4yP+HIwVJqPmCi8Wy9QHFnl2p7YKynQ57E3YIohNFhSwOJgPflH8I6dQ eshxuWXXQp3VmvZTMgMiqdWvs45ugrSCBrNQyOCV58K/CCtdujjdCwLOCQ5MkbeNKQ0Hqy B8JkHsK3USoS3Ws4ZxO3s1gNHZPhYm4= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5CFA4A3B85; Tue, 27 Jul 2021 07:38:18 +0000 (UTC) Date: Tue, 27 Jul 2021 09:38:17 +0200 From: Michal Hocko To: "Matthew Wilcox (Oracle)" Cc: Al Viro , Qualys Security Advisory , Eric Sandeen , Linus Torvalds , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Make kvmalloc refuse to allocate more than 2GB Message-ID: References: <20210721184131.2264356-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210721184131.2264356-1-willy@infradead.org> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E02A95033E02 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=uoReRIZU; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Stat-Signature: 8x38tyisxfcx5ro1bicrudg51m9b4y9a X-HE-Tag: 1627371499-799873 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 21-07-21 19:41:31, Matthew Wilcox wrote: > It's generally dangerous to allocate such large quantities of memory > within the kernel owing to our propensity to use 'int' to represent > a length. If somebody really needs it, we can add a kvmalloc_large() > later, but let's default to "You can't allocate that much memory". I do agree that limiting kvmalloc allocation size is a reasonable thing to do but I do not really see why we should remove the check from seq_buf_alloc. Implicitly relying on kvmalloc to workaround a bug that was in seq_buf code seems like a step backwards to me. -- Michal Hocko SUSE Labs