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 696D8C43333 for ; Mon, 15 Mar 2021 16:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58DBF64F2A for ; Mon, 15 Mar 2021 16:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbhCOQQj (ORCPT ); Mon, 15 Mar 2021 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbhCOQQ2 (ORCPT ); Mon, 15 Mar 2021 12:16:28 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1E5C06174A for ; Mon, 15 Mar 2021 09:16:28 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id n17so11995379plc.7 for ; Mon, 15 Mar 2021 09:16:28 -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=KtyNfdNVVVi2e3+aQIinwqTR8H1ICx3Y7hyfldR1iIOF2f01vFk4aGSgyMEsE6FNNY 19/k3a1GffqYSdaoVZ2mCnsz49ykXB1sGOT9MetQgDk19lG+9Qdb+4JyyXx49Q9Pv4CN z+bYSzvnUIJaIsP4NA8EaFYXxAXcjODk6e0vujiVhLo7/amEJcD3Y7T2J3CMUS5yARLZ iLJjtAlG72iYW9FvvmDS/6oaBiNC/OOKGYvcWKKEp4e/9v5zRXUROYfs5VaJLiMQm9N0 5G0DKoSElvg54Et1xfhG1wOGG4Az8D/bUb2I3WpL26x5nkKv36gTteFTVJiv2Ti5FgD3 BKpg== X-Gm-Message-State: AOAM530muGaiXuuJ79VR+pHUeqkGEClE0qwbx4+PpQnOHYzD1QFwpzAB TlWoVcH1Qp1My04Jy9MXmZUgrA== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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