lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFA6WYOkr0P6yy3S_8gV3vTDZQsRXb9WQ08B4=bgP6qWQ+-c5Q@mail.gmail.com>
Date:   Wed, 11 Oct 2023 11:24:28 +0530
From:   Sumit Garg <sumit.garg@...aro.org>
To:     Jarkko Sakkinen <jarkko@...nel.org>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        David Howells <dhowells@...hat.com>, peterz@...radead.org,
        zohar@...ux.ibm.com, linux-kernel@...r.kernel.org,
        linux-integrity@...r.kernel.org, jejb@...ux.ibm.com,
        David.Kaplan@....com, bp@...en8.de, mingo@...nel.org,
        x86@...nel.org, regressions@...mhuis.info,
        Hyeonggon Yoo <42.hyeyoo@...il.com>
Subject: Re: [PATCH v2] KEYS: trusted: Remove redundant static calls usage

On Wed, 11 Oct 2023 at 00:35, Jarkko Sakkinen <jarkko@...nel.org> wrote:
>
> On Tue, 2023-10-10 at 11:28 -0700, Linus Torvalds wrote:
> > On Thu, 5 Oct 2023 at 22:18, Sumit Garg <sumit.garg@...aro.org> wrote:
> > >
> > > Static calls invocations aren't well supported from module __init and
> > > __exit functions. Especially the static call from cleanup_trusted() led
> > > to a crash on x86 kernel with CONFIG_DEBUG_VIRTUAL=y.
> > >
> > > However, the usage of static call invocations for trusted_key_init()
> > > and trusted_key_exit() don't add any value from either a performance or
> > > security perspective. Hence switch to use indirect function calls instead.
> >
> > I applied this patch to my tree, since it is a fix for the issue, and
> > doesn't change any logic otherwise.
> >
> > However, I do note that the code logic is completely broken. It was
> > broken before too, and apparently causes no problems, but it's still
> > wrong.
> >
> > That's a separate issue, and would want a separate patch, but since I
> > noticed it when applying this one, I'm replying here:
> >
> > > +               trusted_key_exit = trusted_key_sources[i].ops->exit;
> > >                 migratable = trusted_key_sources[i].ops->migratable;
> > >
> > > -               ret = static_call(trusted_key_init)();
> > > +               ret = trusted_key_sources[i].ops->init();
> > >                 if (!ret)
> > >                         break;
> >
> > Note how this sets "trusted_key_exit" even when the ->init() function fails.
>
> Sumit, can you remind me why this continues *on any failure*?

We should give other trust sources a chance to register for trusted
keys if the primary one fails.

-Sumit

>
> E.g. something like this would make more sense to me:
>
>                 ret = trusted_key_sources[i].ops->init();
>                 if (!ret) {
>                         static_call_update(trusted_key_seal, trusted_key_sources[i].ops->seal);
>                         static_call_update(trusted_key_unseal, trusted_key_sources[i].ops->unseal);
>                         static_call_update(trusted_key_get_random, get_random);
>                         static_call_update(trusted_key_exit, trusted_key_sources[i].ops->exit);
>                         migratable = trusted_key_sources[i].ops->migratable;
>                         break;
>                 }
>
>                 if (ret != -ENODEV)
>                         break;
> `
> BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ