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=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 4AA6EC433E0 for ; Mon, 15 Mar 2021 18:11:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE66B64F4B for ; Mon, 15 Mar 2021 18:11:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE66B64F4B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E27DD6B0036; Mon, 15 Mar 2021 14:11:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD7426B006C; Mon, 15 Mar 2021 14:11:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C50396B0070; Mon, 15 Mar 2021 14:11:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id A7FD16B0036 for ; Mon, 15 Mar 2021 14:11:01 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 669428249980 for ; Mon, 15 Mar 2021 18:11:01 +0000 (UTC) X-FDA: 77922899922.21.8A3FDAE Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf29.hostedemail.com (Postfix) with ESMTP id 699BB36830 for ; Mon, 15 Mar 2021 17:47:46 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id p21so58153738lfu.11 for ; Mon, 15 Mar 2021 10:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fdMDCgNpygqH5MPN3KQlWAA4EwgfeKoFJFcXCdqXUfo=; b=JZIC5BeE2vnm8pUt2+wuIoJ7SA4bt95uSMebW/6FIEKwBLWhNK0ZKU95YGgRKMWsPd vApjC6kUSxPuRs6dgtTB0EtpIyysovFu4l+lxJ39sMo0FOwur40bfrez7mHuW4P+SRuI H23dZwOnU38maLlLI/RuBZhyPidpfg5WRdCRbHy0M7ThzvuShKgcHI6lB9nbC32OTmFb riHVSf6Dz8ZQFobiyVIwqCtu/YsIx70UlBQauoTzh/qXpvRb3+MZ2tK8VV1S3D/2vfKu Ecjt8hMnYWkP0O7Nxqhm+8/9YUXHaD8J1wIDjigk33HvzlJjpM/oZ55ItIO2m4CPf9Yl K6+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fdMDCgNpygqH5MPN3KQlWAA4EwgfeKoFJFcXCdqXUfo=; b=MFrzfo0JkTaS/HjtWJalPP5UA7fmVA5w7Ap29F49PQj4BTm0qJuhb1naz+kRTgYUND j4ON7IcBfsQ1SinRzfmyCaZfvkL6H/bpUrrtXpxLH6Do4NQvW5MeRuag6i5YaseFtpWh 8PM7PzpCSpK2ICRuQ+YUuKexL6U+Ci2rj2XlcUrD2n4IrTh8GfoluU519l0eWzqttVv5 UNIih13spzS34ZNMibyjaZn+HZ5nFWfXSbetfyNXzCgxOJXtX+ZYOLV+isx2UhP7kJ+K KdlliLk1oURKUqXx7VDtL6rWrR7OgXeSFJy4G04AoeZcMyqfCmjMvs5kFYvIbH1y7oey gYuw== X-Gm-Message-State: AOAM532prTo0ZmiOJDWMgh7J5DqzVowX57OUQzxqHkmSnHlu/dgqwI+e dfh+oYsFDqfG05TQvQfQy/g= X-Google-Smtp-Source: ABdhPJy6QivAfG/xnyNZaddupxb9bqOukKr0r9K2EEL0KSF/e8VAngPeI1zRXfcNeUveZJ2WY150Mw== X-Received: by 2002:ac2:4316:: with SMTP id l22mr8929717lfh.338.1615830464827; Mon, 15 Mar 2021 10:47:44 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id q3sm2755918lfr.33.2021.03.15.10.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 10:47:43 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 15 Mar 2021 18:47:42 +0100 To: Kees Cook Cc: Uladzislau Rezki , 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: <20210315174742.GA2038@pc638.lan> References: <20210309135757.5406-1-toiwoton@gmail.com> <20210314172312.GA2085@pc638.lan> <20210315122410.GA26784@pc636> <202103150914.4172D96@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103150914.4172D96@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: xwyubn6d8hax8wny9wh8eu5j66c1m588 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 699BB36830 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-lf1-f44.google.com; client-ip=209.85.167.44 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615830466-18609 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 09:16:26AM -0700, Kees Cook wrote: > 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. > Probably we can randomize a base address only once when pcpu-allocator allocates a fist chunk during the boot. > > - 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. > It should be split as well as tested. -- Vlad Rezki