Linux Security Modules development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: KP Singh <kpsingh@kernel.org>
Cc: Paul Moore <paul@paul-moore.com>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, bp@alien8.de,
	sfr@canb.auug.org.au, peterz@infradead.org,
	ink@jurassic.park.msu.ru, richard.henderson@linaro.org
Subject: Re: [PATCH] init/main.c: Initialize early LSMs after arch code
Date: Tue, 13 Aug 2024 09:26:02 -0700	[thread overview]
Message-ID: <f088987e-32d5-4a86-808e-6cfc372c3c80@roeck-us.net> (raw)
In-Reply-To: <CACYkzJ4eZWh2R_ZoeiNLLKFARWJOWo7Hkdp015fHEnmYLJaHGQ@mail.gmail.com>

On 8/13/24 08:56, KP Singh wrote:
> On Tue, Aug 13, 2024 at 6:08 AM Guenter Roeck <linux@roeck-us.net> wrote:
[ ... ]
>> A somewhat primitive alternate fix is:
>>
>> diff --git a/security/security.c b/security/security.c
>> index aa059d0cfc29..dea9736b2014 100644
>> --- a/security/security.c
>> +++ b/security/security.c
>> @@ -156,7 +156,7 @@ static __initdata struct lsm_info *exclusive;
>>     * and a trampoline (STATIC_CALL_TRAMP) which are used to call
>>     * __static_call_update when updating the static call.
>>     */
>> -struct lsm_static_calls_table static_calls_table __ro_after_init = {
>> +struct lsm_static_calls_table static_calls_table __ro_after_init __attribute__((aligned(8))) = {
>>    #define INIT_LSM_STATIC_CALL(NUM, NAME)                                        \
> 
> I think it's worth making it aligned at 8 byte, a much simpler fix
> than the arch change. Paul, I will rebase my series with these
> patches, better descriptions and post them later today.
> 

I think that would make sense, since it might well be that other architectures
have similar problems but it isn't seen because static_calls_table just happens
to be aligned properly there. Also, even if unaligned accesses that early were
supported, it is probably undesirable to have those in the running code if it
can be avoided due to the overhead involved.

With the above change:

Build results:
	total: 158 pass: 158 fail: 0
Qemu test results:
	total: 539 pass: 539 fail: 0
Unit test results:
	pass: 370886 fail: 3

There are a couple of caveats, unrelated to your patch series:
- I can not enable (and thus not test) security configurations
   on sh4 and sh4eb; doing so results in immediate qemu crashes.
- I can not enable / test security configurations on riscv32
   since it results in kernel images getting too large to fit
   into the available memory. I'll try to work around it,
   but for now I can only test with riscv64.

Guenter


  reply	other threads:[~2024-08-13 16:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 17:17 [PATCH] init/main.c: Initialize early LSMs after arch code KP Singh
2024-08-05 19:57 ` Paul Moore
2024-08-05 23:29   ` KP Singh
2024-08-06  2:20     ` Nathan Chancellor
2024-08-06 21:41       ` Paul Moore
2024-08-07 20:44         ` Paul Moore
2024-08-07 22:45           ` KP Singh
2024-08-07 22:50             ` KP Singh
2024-08-07 23:43             ` Paul Moore
2024-08-08  0:30               ` KP Singh
2024-08-08  0:34               ` Guenter Roeck
2024-08-08  0:40                 ` KP Singh
2024-08-08  1:20                   ` Guenter Roeck
2024-08-08  1:18                 ` Paul Moore
2024-08-08  1:40                   ` Guenter Roeck
2024-08-08  2:13                   ` Guenter Roeck
2024-08-08  4:07                     ` Guenter Roeck
2024-08-08  9:57                       ` KP Singh
2024-08-08 15:20                         ` Guenter Roeck
2024-08-08 16:43                         ` Guenter Roeck
2024-08-08 17:32                           ` Paul Moore
2024-08-08 18:00                             ` Guenter Roeck
2024-08-08 20:49                               ` Paul Moore
2024-08-12 17:12                                 ` KP Singh
2024-08-12 19:33                                   ` Paul Moore
2024-08-12 21:14                                     ` KP Singh
2024-08-12 21:32                                       ` Paul Moore
2024-08-12 22:02                                         ` KP Singh
2024-08-13  4:07                                           ` Guenter Roeck
2024-08-13 15:56                                             ` KP Singh
2024-08-13 16:26                                               ` Guenter Roeck [this message]
2024-08-13 18:21                                               ` Paul Moore
2024-08-08 17:19                         ` Paul Moore
2025-03-11 13:37 ` joeyli
2025-03-11 15:14   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f088987e-32d5-4a86-808e-6cfc372c3c80@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bp@alien8.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=paul@paul-moore.com \
    --cc=peterz@infradead.org \
    --cc=richard.henderson@linaro.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox