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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 51897C433E9 for ; Mon, 15 Mar 2021 16:35:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D6BAB64F2A for ; Mon, 15 Mar 2021 16:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6BAB64F2A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3E30E6B0070; Mon, 15 Mar 2021 12:35:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 392B46B0071; Mon, 15 Mar 2021 12:35:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 232B66B0072; Mon, 15 Mar 2021 12:35:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 0B2656B0070 for ; Mon, 15 Mar 2021 12:35:53 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BC23912C6 for ; Mon, 15 Mar 2021 16:35:52 +0000 (UTC) X-FDA: 77922660144.27.8DE790E Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf01.hostedemail.com (Postfix) with ESMTP id C54CB202093E for ; Mon, 15 Mar 2021 16:16:35 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id z5so15564567plg.3 for ; Mon, 15 Mar 2021 09:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qUbNPoyJNI0p475d5f3CQqbt9mQMt4DepM5CFXS3wjU=; b=Bxh1CL5PZWIGVBGdFGdjCmlxM1BJeW1oPj3IWF2YhXBqYM4f+6vKceGfmW7x696iPS WtWca31ZbxmTdK88SVKQpWF8ilc3K3L4qY2/1fxnDa6Gi3xn8eJTE5Odi3HhBc8Yioma uh51Ay5Hot/L43sQXFrrToeoFIGWndzVGKB1g= 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=qUbNPoyJNI0p475d5f3CQqbt9mQMt4DepM5CFXS3wjU=; b=TVF+cjZhPcV1hprsxld/y1J7wIsT+JCsIAP/Wxr03/+zNIfrsiEuKKFz0dGBsvgDs0 uABR0mH0b9bJXfMUvKqNl/Z9neumAsKOJ3V+K9M24682Wn8+hsvEPPFB683Q6Y8vR/bB lfNDYwpAD9cjKPbRTYzbCpTrhmPa5oWLO44hABILcD5utgi0zhql6fWuhCOm21gjzydN Uva8164XcGcCNReS5E5TzBNzj8Mg/PxZyIICbPap3OB6humc8ytftT6QfXG5KPbFrBOs ITvGAobKAk+AaZkhTEqJiELrVzpgvlzVZaAQeexVkLEMsHDFoGyiMcER9JVklIfLbapq eZHg== X-Gm-Message-State: AOAM533JVJMuezb00412Pe0tVURCgwls77VrrNLwgmTngI0n0EAfDR1c CPgF3Vo+uwcPOgV+3Ua6/Fc8kw== X-Google-Smtp-Source: ABdhPJwyuitbf4ebUbZHbasW6NJC0ii7LhiMoi8oLWHW+iYq+9W48zWbXAS3jEAl344tzAvZq6K0tQ== X-Received: by 2002:a17:90b:e08:: with SMTP id ge8mr13279801pjb.130.1615824987909; Mon, 15 Mar 2021 09:16:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id bk8sm98493pjb.13.2021.03.15.09.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 09:16:27 -0700 (PDT) Date: Mon, 15 Mar 2021 09:16:26 -0700 From: Kees Cook To: Uladzislau Rezki Cc: Topi Miettinen , linux-hardening@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Jann Horn , Linux API , Matthew Wilcox , Mike Rapoport Subject: Re: [PATCH v4] mm/vmalloc: randomize vmalloc() allocations Message-ID: <202103150914.4172D96@keescook> References: <20210309135757.5406-1-toiwoton@gmail.com> <20210314172312.GA2085@pc638.lan> <20210315122410.GA26784@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210315122410.GA26784@pc636> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C54CB202093E X-Stat-Signature: 5taowbtiircmguqpr1jzu88h6fqhsj46 Received-SPF: none (chromium.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-pl1-f170.google.com; client-ip=209.85.214.170 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615824995-364605 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 Mon, Mar 15, 2021 at 01:24:10PM +0100, Uladzislau Rezki wrote: > On Mon, Mar 15, 2021 at 11:04:42AM +0200, Topi Miettinen wrote: > > What's the problem with that? It seems to me that nothing relies on specific > > addresses of the chunks, so it should be possible to randomize these too. > > Also the alignment is honored. > > > My concern are: > > - it is not a vmalloc allocator; > - per-cpu allocator allocates chunks, thus it might be it happens only once. It does not allocate it often; That's actually the reason to randomize it: if it always ends up in the same place at every boot, it becomes a stable target for attackers. > - changing it will likely introduce issues you are not aware of; > - it is not supposed to be interacting with vmalloc allocator. Read the > comment under pcpu_get_vm_areas(); > > Therefore i propose just not touch it. How about splitting it from this patch instead? Then it can get separate testing, etc. -- Kees Cook