From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756808AbdEHUMq (ORCPT ); Mon, 8 May 2017 16:12:46 -0400 Received: from smtp-sh.infomaniak.ch ([128.65.195.4]:59288 "EHLO smtp-sh.infomaniak.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756729AbdEHUMp (ORCPT ); Mon, 8 May 2017 16:12:45 -0400 Subject: Re: [PATCH v1] LSM: Enable multiple calls to security_add_hooks() for the same LSM To: Casey Schaufler , James Morris , Tetsuo Handa References: <20170429190257.27137-1-mic@digikod.net> Cc: linux-kernel@vger.kernel.org, James Morris , Kees Cook , "Serge E . Hallyn" , linux-security-module@vger.kernel.org From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <0d09a5df-32d0-139e-c401-17d502eb8d5b@digikod.net> Date: Mon, 8 May 2017 22:12:10 +0200 User-Agent: MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Is4spv94nKIL0jaRuKRK7AqJgd49fL07t" X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Is4spv94nKIL0jaRuKRK7AqJgd49fL07t Content-Type: multipart/mixed; boundary="Ge4uebRoG20NIJcv1e9QOcTFiq7QUqeEM"; protected-headers="v1" From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= To: Casey Schaufler , James Morris , Tetsuo Handa Cc: linux-kernel@vger.kernel.org, James Morris , Kees Cook , "Serge E . Hallyn" , linux-security-module@vger.kernel.org Message-ID: <0d09a5df-32d0-139e-c401-17d502eb8d5b@digikod.net> Subject: Re: [PATCH v1] LSM: Enable multiple calls to security_add_hooks() for the same LSM References: <20170429190257.27137-1-mic@digikod.net> In-Reply-To: --Ge4uebRoG20NIJcv1e9QOcTFiq7QUqeEM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/05/2017 22:07, Casey Schaufler wrote: > On 5/8/2017 12:24 PM, Micka=C3=ABl Sala=C3=BCn wrote: >> On 01/05/2017 01:28, James Morris wrote: >>> On Sat, 29 Apr 2017, Micka=C3=ABl Sala=C3=BCn wrote: >>> >>>> Check if the registering LSM already registered hooks just before. T= his >>>> enable to split hook declarations into multiple files without >>>> registering multiple time the same LSM name, starting from commit >>>> d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm"). >>> Please include a detailed rationale for these patches. The above tel= ls us=20 >>> very little about why they are needed. >> Right, what do you think about that? >> >> The commit d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm") extend >> security_add_hooks() with a new parameter to register the LSM name, >> which may be useful to make the list of currently loaded LSM available= >> to userspace. However, there is no clean way for an LSM no split its >> hook declarations into multiple files, which may reduce the mess with >> all the included files (needed for LSM hook argument types) and make t= he >> source code easier to review and maintain. >> >> This change allows an LSM to register multiple times its hook while >> keeping a consistent list of LSM names as described in >> Documentation/security/LSM.txt . The list reflects the order in which >> checks are made. This patch only check for the last registered LSM, >> which should be the only case. If an LSM register multiple times its >> hooks, interleaved with other LSM registrations, which should not >> happen, its name will still appear in the same order that the hooks ar= e >> called, hence multiple times. >> >> >> Casey, Tetsuo, are you OK with this approach or do you want me to hand= le >> the case with interleaved hook registration, i.e. no duplicate name no= r >> following the current Documentation/security/LSM.txt? >> What about the API with the NULL name (which is much simpler)? >=20 > Initially I thought that the module name should > never appear more than once, however I could see > a module that would bracket another or another set, > so >=20 > capability,spiffy,selinux >=20 > might be different behaviorally than >=20 > capability,spiffy,selinux,spiffy >=20 > and userspace might care. I still don't see any value > in >=20 > capability,selinux,spiffy,spiffy >=20 > Passing a NULL name could lead to ambiguity if more > than one module did that, so I can't say I approve. OK, so this patch seems good. --Ge4uebRoG20NIJcv1e9QOcTFiq7QUqeEM-- --Is4spv94nKIL0jaRuKRK7AqJgd49fL07t Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEUysCyY8er9Axt7hqIt7+33O9apUFAlkQ0RoACgkQIt7+33O9 apXAuggAkfS9noS7PYBX1I74s+TsWWIq58jgQiMc/oHxio+gSUw3QD2JzIyadyb5 H4PGJ77wmjtOYuIlx++7fjOIOlxQcF4wsb+hlwSo/DXbGO0CnHiNlWdfQ08Lg01B T3TBF/iTtAYO2PU+wFnD5n4Jdqf8ogAe/zxqSfd2loNYaKgxLgmQ8Kfixwm6TK5b QucvBH3nkgQpXA/ewyrTFSVsnYb1SRBJ3RnJLznmGhuBM+5r1UYUJmVUAj5l40bn 9ejRiH5Ks5AGjQ1k+k7+PVd5FljRViLS+AFYMeIghNPq7YjONoBMuKWiQadwANHJ t+JmunSwKVh+kPgrCHLh0urqkfw2DA== =pQbS -----END PGP SIGNATURE----- --Is4spv94nKIL0jaRuKRK7AqJgd49fL07t--