Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2435945imm; Sat, 29 Sep 2018 19:37:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61OJ/xMldzO6EcmsX6S//wK8a5W/+nWd5X3VJ9S3Vz1Jm37JubyXIMJ6lFac/URRCIOJHZG X-Received: by 2002:a17:902:2:: with SMTP id 2-v6mr5558570pla.178.1538275056941; Sat, 29 Sep 2018 19:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538275056; cv=none; d=google.com; s=arc-20160816; b=MbVeYbkpFZcUt0bQ171DrOKgqtSz1vyn8MCtoAM0kumzRFhEALQXAgRYwOMhcPboKc lFuADOqyoWc9uTuga7xrQHdv52flTxUJc+fj4hr4eHepGHEW1N+SWcBVSpfdAmNTHzsx KCcUvbLOcfGzD58lPk/y0QacTsal5jKdNYak9uPY1xeHBBTmKnA5QGhtlXMlbqpGoW5g +yoi347OlG+2XMHibUulPPkKQ4xvHK4HWTmwpkwsSIqZGOVdYm5WffBSsV/wl87EMlqq URdsUNH3nKQwcmF/yAizHQio1qHVLIXML8038wTlpwL/1PmsWBpUETPsHWLU6V1jdqvx TBzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=FBjrt0rQ631SmuyL6vh95+h5YK0jey1y62llHFsKVVk=; b=PXVcLBKibL8uPiobIJzoNcQbgZE9+ZZR+wvfc0g6swoPuitlL7Fi8pHZo7xG/A7UTq yPjbFbrGgFjq8DtMwBc5AzPCV2SRUioF07WrwHF3LG+r2nIK1j0g8gleEv1qLo1v1Wf/ 9C8SEDGtkAvlONpCFCC/pzxbWjX+OcMOgeu1sLy9SI7MQ/6C6TixYFGVrvb6d2oqk0di XrlSiOpDjVaw6MKMXkpkJzrq3mNVXTWcwG6ApXXowCYxDYPqP5h131jmmo5slJBNfdqw +qjsV3SUhwBSWRa859VJ5NwhBdcxHFQOwpM5mrgAIUA5Lxz+FH5ye60Cmpw4a9yIaopc 37EQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s7-v6si8638800pfm.217.2018.09.29.19.37.22; Sat, 29 Sep 2018 19:37:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727703AbeI3JIB (ORCPT + 99 others); Sun, 30 Sep 2018 05:08:01 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:16849 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbeI3JIA (ORCPT ); Sun, 30 Sep 2018 05:08:00 -0400 Received: from fsav107.sakura.ne.jp (fsav107.sakura.ne.jp [27.133.134.234]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w8U2aX89046601; Sun, 30 Sep 2018 11:36:33 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav107.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav107.sakura.ne.jp); Sun, 30 Sep 2018 11:36:33 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav107.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w8U2aG6w046410 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 30 Sep 2018 11:36:33 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) From: Tetsuo Handa Subject: Re: [PATCH security-next v3 00/29] LSM: Explict LSM ordering To: Kees Cook Cc: Casey Schaufler , James Morris , John Johansen , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , Jonathan Corbet , "open list:DOCUMENTATION" , linux-arch , LKML References: <20180925001832.18322-1-keescook@chromium.org> Message-ID: <67c14d95-10f6-37d5-ee8a-c1fb6a6d460a@i-love.sakura.ne.jp> Date: Sun, 30 Sep 2018 11:36:15 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/09/30 3:18, Kees Cook wrote: >> Just wondering what is "__lsm_name_##lsm" for... >> >> +#define DEFINE_LSM(lsm) \ >> + static const char __lsm_name_##lsm[] __initconst \ >> + __aligned(1) = #lsm; \ >> + static struct lsm_info __lsm_##lsm \ >> + __used __section(.lsm_info.init) \ >> + __aligned(sizeof(unsigned long)) \ >> + = { \ >> + .name = __lsm_name_##lsm, \ >> + >> +#define END_LSM } > > I wasn't super happy with the END_LSM thing, but I wanted to be able > to declare the name as __initconst, otherwise it needlessly stays in > memory after init. That said, it's not a huge deal, and maybe > readability trumps a tiny meory savings? The value of .name field is a few bytes string, and is not sensitive information. Keeping such string in non-__initdata section unlikely increases total memory pages required for that module. Unless we need to generate unique address of such string for some reason, I think that this saving is pointless.