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=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 4DFD6C63777 for ; Thu, 3 Dec 2020 06:59:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD84A20758 for ; Thu, 3 Dec 2020 06:59:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729861AbgLCG6u (ORCPT ); Thu, 3 Dec 2020 01:58:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:46992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgLCG6u (ORCPT ); Thu, 3 Dec 2020 01:58:50 -0500 Date: Thu, 3 Dec 2020 08:58:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1606978689; bh=TrahpHtUn6GtqyFBng48QBtZBmbO/ucz4YAA+WbUKig=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=ghQbsZuCi9XwCdX3NAJgSxP/7c1XcmHf/kQRBOIXzOlRecfT6XSTYQYgl5tvlwx6D R0SQ+Dw2FdGkfYaqbMk8zDkUTfAWezJfVeqpWK13vz/lge/dC0LiMiJkVnhGgTE0Ty 9dFdYrskZBgZZCqkgJxmSoPXJA0tvF5BoYCnE3i6d2j6hK/OOmhR8SYA6P928RvKF6 Ruo96i16CQ13dghMOmpBRz9ioP0mhCzH5OM5/IUJhmRz3oWA//FgYExkptVENDeWvt 9ZuN8MgMcCGsZx4pYWPD/AIQF1XKrLbtoIh7YggGewNqT45S5NeO60FA2sZmb++1Lz yYIfGJawsZuUA== From: Mike Rapoport To: Topi Miettinen Cc: linux-hardening@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Jann Horn , Kees Cook , Linux API , Matthew Wilcox Subject: Re: [PATCH] mm/vmalloc: randomize vmalloc() allocations Message-ID: <20201203065801.GH751215@kernel.org> References: <20201201214547.9721-1-toiwoton@gmail.com> <9d34fb0a-7aba-1e84-6426-006ea7c3d9f5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d34fb0a-7aba-1e84-6426-006ea7c3d9f5@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 02, 2020 at 08:49:06PM +0200, Topi Miettinen wrote: > On 1.12.2020 23.45, Topi Miettinen wrote: > > Memory mappings inside kernel allocated with vmalloc() are in > > predictable order and packed tightly toward the low addresses. With > > new kernel boot parameter 'randomize_vmalloc=1', the entire area is > > used randomly to make the allocations less predictable and harder to > > guess for attackers. > > > > This also seems to randomize module addresses. I was going to check that > next, so nice surprise! Heh, that's because module_alloc() uses vmalloc() in that way or another :) > -Topi > > > spin_unlock(&free_vmap_area_lock); > > if (unlikely(addr == vend)) > > > -- Sincerely yours, Mike.