Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp881970pxu; Thu, 3 Dec 2020 15:20:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyC+3UvyZy755m11NhZ0DOt/W7TT5kz56C5sLtrJV8CbiegRwaJVcnEIK0LMLFELxbH7/36 X-Received: by 2002:a17:906:98d4:: with SMTP id zd20mr4658733ejb.532.1607037620539; Thu, 03 Dec 2020 15:20:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607037620; cv=none; d=google.com; s=arc-20160816; b=l1m4jOK5LHhi4llWE46MTceoazG2ZJDmIYRCH6M4unShyLJDW1SQcFqR19Bu0MQoaa 7KxkJ0ba25W4BDbunMoOLV+7Hj0kLmwjwljCTavCSklB4nRTo6OBeyBy45gUwIjJAT2l nM2JgRz/46T1FRJEZ7DX4ZiPIcvYZrx0+XwV2js23XuNDgRQsMeD7HA6qHpBEZOqLXHb 2r1pXRafaRKMB6im/RoRkbQB1B+Xk2YnXyb8GZjZbvqvVW78YJJy+dlRcAOlry08lYZw UIkmnTE6/OpOtg/m03ZzDJcB4TDcgn3qVRa7wOCGQU1F6zK0n4LORtyFD1507EK13qOe MTcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=3NVOGHzbD/MCJ9GzxTECdF1fHr2d1jTCBtco1ExvU6o=; b=jFIKucAMIaq7AMiU+WHRtr2v0RYOfzqi2PscQSkokZkdjbDOuMuwumKOe2z5HE0uER 0kbh4T+mk6p1/rS6AyxCovV4RJVDfUxinIEktTh1Qeg2Lz0yeeXeaHtgGiFq/TYweRE9 ZwEpIxJdH3pL5PkpjvbcFQ3Vc2rituy0BydPIVz8x7NQ4gSruAdjR0OCW+i6SOJkn9j0 XxnOUxhF4O3CZSag6QVylHqHephslaRGdhT0I2hzO5xjgVT+cuQympVlfwfRyVoP56/l z/AqbBdqR+eQs0AvkdI9Ht0o+bBjUpiKqtNBYNbcDqmbZ/6IdYXMfq8A6c1FJK3rY9wm pXUg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr22si267715ejc.411.2020.12.03.15.19.58; Thu, 03 Dec 2020 15:20:20 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbgLCXRj convert rfc822-to-8bit (ORCPT + 99 others); Thu, 3 Dec 2020 18:17:39 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:42756 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbgLCXRj (ORCPT ); Thu, 3 Dec 2020 18:17:39 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-74-ZN_hijpIMCiOzkEhiip_Rg-1; Thu, 03 Dec 2020 23:16:00 +0000 X-MC-Unique: ZN_hijpIMCiOzkEhiip_Rg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 3 Dec 2020 23:15:59 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 3 Dec 2020 23:15:59 +0000 From: David Laight To: 'Mike Rapoport' , 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 Thread-Topic: [PATCH] mm/vmalloc: randomize vmalloc() allocations Thread-Index: AQHWyUIaOaq71c1O10ObeOeJDE6bhanmALEg Date: Thu, 3 Dec 2020 23:15:59 +0000 Message-ID: <2a672ff3df0c47538ed7d1974c864f0b@AcuMS.aculab.com> References: <20201201214547.9721-1-toiwoton@gmail.com> <9d34fb0a-7aba-1e84-6426-006ea7c3d9f5@gmail.com> <20201203065801.GH751215@kernel.org> In-Reply-To: <20201203065801.GH751215@kernel.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport > Sent: 03 December 2020 06:58 > > 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. Isn't that going to horribly fragment the available address space and make even moderate sized allocation requests fail (or sleep). I'm not even sure that you need to use 'best fit' rather than 'first fit'. 'best fit' is certainly a lot better for a simple linked list user space malloc. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)