From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965012AbeCGUXx (ORCPT ); Wed, 7 Mar 2018 15:23:53 -0500 Received: from sonic304-28.consmr.mail.ne1.yahoo.com ([66.163.191.154]:40070 "EHLO sonic304-28.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964783AbeCGUXv (ORCPT ); Wed, 7 Mar 2018 15:23:51 -0500 X-YMail-OSG: ofDZZVgVM1kLHtKnElEuiVwg3ea_WTCNdmO7JTk4kxUheBGTnajMUf7PB_bWoTM dXCBxygUpuL.j0EwtjdUctiJaHa3TKOLdN1HI1qxJt.CN.YEunPer9OrSXbk_BLUKpnbSWUHTYYc ZbGmxMmCPTULEjFh.1XJoVsZINFrDsfNlPf.rUXCQasWipVEYMUhyqPjGJf.JtsZLKiXW2MQtzc. gNer5IjxpS1ESs5qgAR3vsUpMYtJXZUUa_ICJqIorpeBQk3ipRbzBaX0ZqtS6rjXVmCH7_9JV_yI comQjh_JhLlkV47DW0jNP04dBartk78bO.t2R6M0hGgZiGsbNTWr3m3BOb5N6ecdCSbEZugUgT9E xkCDYd4.DGUAN3qo6cZqOlFV5Ih8nwOvhQOLd9Z1j10z3E1uLo4mdfp5zdV1yScgFnV7Dz1OL6Ip U76soze0_r2c.SMLsr7NiaIrxe2PXFJs1TIcN6SljzdxrYwkO_0BfyvP6kBeAxwxyGkzpVYXHx48 TSDNLJZfWO6uIaSYtVZqU.1YkymtyMN71hDSdpjy4f287PZKCf8uh1jDLnlpyz496 Subject: Re: [PATCH v4 1/3] security: Refactor LSM hooks into an array and enum To: Sargun Dhillon Cc: LSM , LKML , Tetsuo Handa , Kees Cook , Igor Stoppa References: <3646ff78915fcbadbc660257d92921e5442553e0.1520407240.git.sargun@sargun.me> From: Casey Schaufler Message-ID: <6326ecfe-83f9-13d8-d59a-58d567726b07@schaufler-ca.com> Date: Wed, 7 Mar 2018 12:23:47 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/7/2018 11:18 AM, Sargun Dhillon wrote: > On Wed, Mar 7, 2018 at 9:45 AM, Casey Schaufler wrote: >> On 3/6/2018 11:23 PM, Sargun Dhillon wrote: >>> This commit should have no functional change. It changes the security hook >>> list heads struct into an array. Additionally, it exposes all of the hooks >>> via an enum. This loses memory layout randomization as the enum is not >>> randomized. >> Please explain why you want to do this. I still dislike it. >> > Do you dislike it because of the loss of randomization, or some other reason? I dislike a huge array of untyped function pointers. I dislike the loss of type checking in security.c > The reason for not just having a second list_heads is that it's > somewhat ugly having to replicate that structure twice -- once for > dynamic hooks, and once for 'static' hooks. There was discussion about this some time ago. In the case where you don't allow dynamic hooks, you mark the lists ro_after_init whereas in the case with them you don't, but use the locking. > Instead, we have one enum that LSMs can use and two arrays of heads > rather than an entire unrolled set of list_heads. But how is this better? What is the advantage? > > If we had a way to randomize this, would it make you comfortable? >