Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3429292pxf; Mon, 15 Mar 2021 09:19:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD6Tb88bdnri5C8XxZ4vBXAKavDg/tEV0emkYJZtnPBrbWx5z8zrBT9cmDQSwlTQEYlTO6 X-Received: by 2002:a17:906:684b:: with SMTP id a11mr23885319ejs.329.1615825179179; Mon, 15 Mar 2021 09:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615825179; cv=none; d=google.com; s=arc-20160816; b=RueZIJ2wlctNH1voEj+blz/QqqLS20n/82VVtuLTP+nrx20tDw4fQ1jRBTPVwmOpML oz1jL6GwEoT784V7IoJ3vHdxbbbZ9CuVQQOyj9F2Y3s880HrfA9YB05tIOlvHQQ4f0Gn LMFaYO8AqmDQ79Krf4ox4ix1XXJkCGPIy8FR9DRwDwUEyR2weV+udMWuvkx/tC8MiZNj R6Qwg6AabNFQNXdhWjEYLv/FQk8p/MFzc1DGeKytX8R8WWxboUYWqWIXO41YWc42Hbth INDQMxoTe35zL1ev0UxehJHAS/OWq9xWq8Ku6dSXiM13OcTqv46S9jtbqhd+NmJB8bjB kQLw== 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=qUbNPoyJNI0p475d5f3CQqbt9mQMt4DepM5CFXS3wjU=; b=V+rE9Z9UxXsiiEjGEuid7FKUZv+z0eXJOGqVGul6zn6ZbrpE4WxPHIDubHhcoQ2d+w A7CCm61B7jhHsStPNm5ItyYVGwafbE526HIpK4drEitEt40pgRlXZ1MBMPE8VVdZCJw/ nRpSScBgz1/FQWVpjjJdqufuXx03r/ak6Nusc+nGMnP4GRUhMb5K7xrOAVqMTOxFoTiz 7r8TvaSp6LZ2K5vl9w110AVRpqcFxXyhHesgz5DSyq5yuYMYltAD9Lc6Ou5m4a1CJtQn /N5H3+heZN/cSpfVuTx/XRCmJQu05ps2Jess5uItQVMx8Rj/RLDU1vKbgPHKinoo+5Z7 nOUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bxh1CL5P; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc7si10939531edb.420.2021.03.15.09.19.17; Mon, 15 Mar 2021 09:19:39 -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=@chromium.org header.s=google header.b=Bxh1CL5P; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbhCOQQi (ORCPT + 99 others); Mon, 15 Mar 2021 12:16:38 -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-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