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.3 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,NICE_REPLY_A,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 25F19C433DB for ; Tue, 16 Mar 2021 08:01:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A220764FC4 for ; Tue, 16 Mar 2021 08:01:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A220764FC4 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 2B9598D0001; Tue, 16 Mar 2021 04:01:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2908D6B0072; Tue, 16 Mar 2021 04:01:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 131178D0001; Tue, 16 Mar 2021 04:01:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id E60D96B0071 for ; Tue, 16 Mar 2021 04:01:52 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9F2C5181B04A2 for ; Tue, 16 Mar 2021 08:01:52 +0000 (UTC) X-FDA: 77924993664.18.8828ED3 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf15.hostedemail.com (Postfix) with ESMTP id 16BE7A0009DD for ; Tue, 16 Mar 2021 08:01:51 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id v9so61002213lfa.1 for ; Tue, 16 Mar 2021 01:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nhPJC9wzAEpJ+jE+VGfpIliqBXvwzpfxSi1AqRybceE=; b=d5cCDtFG4kTdcsmxqRALSq4WBRWUBYtKaYREhuAdZvZgJ2Kp91SFlGjcoJKJ+critV JUfXmDt6qmdEsYACsQ4YyQdcpSddCdLQE0l8P0ndEEp6/WPv+xlVFH8eG8lk8t9a7QsF 1yRGgjS1BJcQgaqqsohpXkLJkWl7htXi9sI5Jw6V7hGVvAtWzxzymly281iO2h27Hu9b X5TwhbrLpu/pOmZWEd3WUXiM/odwODUQHHTqYHvpnuqMVJZTzV611WkDOeplEGyYDLNN 82cGVPUjuDJpViav/ltjWvn9pl2BvLqWKFE37YlEB611X0ICwEeETFy++5Mk2/V5kwqr KPYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nhPJC9wzAEpJ+jE+VGfpIliqBXvwzpfxSi1AqRybceE=; b=cGRwBCYcRjyOs623V4wWmkiXCVr4F25lveKmmAVj4TS32xcbolG0t5xTQP8Pf3F4XA KFHytrrjr6t0hHgKaLcadUWHZo5PmnWwkuWDZiN2u9tpS0eG2u9Dcb//U75yOTcl+L/o pEIXMxqHvxq6MGpB2duBmkNYtxnxRYgNj3BYYHZXAjs7S9g+j8gqqqwGNaNC8XaIwijk ktsq/YQ0xY7L8krO0jdsyqbg9mah4SdtDSjuI9d/J8uYmIWUgD7lXechqhwqOw5Y0jGl d7SOZJAdSMnXQNMnUyG/yiDI3FJMWyCiOFO93Z07WurXMb3TbUjJMsJsGNuCr3Q4E+83 1Aaw== X-Gm-Message-State: AOAM533fbpaRaixujCfOi/d6mR0eYcRaAdIrI0ximGirEFe/k26DbI1P SbyY+auo8MKqgQfg05TxKbo= X-Google-Smtp-Source: ABdhPJxbHKpOtwcSZgEDd4Sb73ytAiD+HkMe1ubr8slYwelIN437r1j1b4kFmaIQnAURidQFkDTWBw== X-Received: by 2002:a05:6512:3042:: with SMTP id b2mr9693809lfb.480.1615881710506; Tue, 16 Mar 2021 01:01:50 -0700 (PDT) Received: from [192.168.1.39] (88-114-223-25.elisa-laajakaista.fi. [88.114.223.25]) by smtp.gmail.com with ESMTPSA id v22sm2963626lfr.277.2021.03.16.01.01.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Mar 2021 01:01:49 -0700 (PDT) Subject: Re: [PATCH v4] mm/vmalloc: randomize vmalloc() allocations To: Uladzislau Rezki , Kees Cook Cc: 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 References: <20210309135757.5406-1-toiwoton@gmail.com> <20210314172312.GA2085@pc638.lan> <20210315122410.GA26784@pc636> <202103150914.4172D96@keescook> <20210315174742.GA2038@pc638.lan> From: Topi Miettinen Message-ID: <85515ea8-744e-acec-76ba-034b38d0f9fa@gmail.com> Date: Tue, 16 Mar 2021 10:01:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210315174742.GA2038@pc638.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: gbk4oaa4xsgzdy5j4q6rf68igdntsgj4 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 16BE7A0009DD Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=mail-lf1-f49.google.com; client-ip=209.85.167.49 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615881711-296910 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 15.3.2021 19.47, Uladzislau Rezki wrote: > 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. Would you prefer another kernel option `randomize_percpu_allocator=1`, or would it be OK to make it a flag in `randomize_vmalloc`, like `randomize_vmalloc=3`? Maybe the latter would not be compatible with static branches. -Topi > > -- > Vlad Rezki >