From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>,
xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org,
sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org,
u-boot@lists.denx.de
Subject: Re: [PATCH v5 02/11] tools: mkeficapsule: add firmwware image signing
Date: Fri, 5 Nov 2021 10:04:33 +0900 [thread overview]
Message-ID: <20211105010433.GA27316@laputa> (raw)
In-Reply-To: <CAPnjgZ2XRhnAstSOvnwYoiRZKufT3aNim8nNwjUADxxPhRpcBA@mail.gmail.com>
Hi, Simon,
On Thu, Nov 04, 2021 at 09:11:59AM -0600, Simon Glass wrote:
> Hi Mark,
>
> On Thu, 4 Nov 2021 at 08:31, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> >
> > > From: Simon Glass <sjg@chromium.org>
> > > Date: Wed, 3 Nov 2021 20:51:25 -0600
> > >
> > > Hi Mark,
> > >
> > > On Tue, 2 Nov 2021 at 09:13, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > > >
> > > > > From: Simon Glass <sjg@chromium.org>
> > > > > Date: Tue, 2 Nov 2021 08:56:50 -0600
> > > > >
> > > > > Hi Takahiro,
> > > > >
> > > > > > > - can we just build the tool always?
> > > > > >
> > > > > > This is one of my questions.
> > > > > > Why do you want to do so while there are bunch of tools that are
> > > > > > not always built.
> > > > >
> > > > > Because I think all tools should be built always. It is fine if that
> > > > > happens due to CONFIG options but we should try to avoid making it
> > > > > complicated.
> > > >
> > > > Well, unless this patchset fixes things, we can't, because
> > > > mkeficapsule doesn't build on OpenBSD. I tried looking into it, but I
> > > > can't figure out how this is even supposed to compile as a host tool:
> > > >
> > > >
> > > > In file included from tools/mkeficapsule.c:8:
> > > > In file included from include/malloc.h:369:
> > > > include/linux/string.h:15:24: error: conflicting types for 'strspn'
> > > > extern __kernel_size_t strspn(const char *,const char *);
> > > > ^
> > > > /usr/include/string.h:88:9: note: previous declaration is here
> > > > size_t strspn(const char *, const char *);
> > >
> > > My guess is that linux/string.h should not be included, or perhaps
> > > __kernel_size_t should be defined to size_t.
> > >
> > > I doubt it would take an age to figure out, with a bit of fiddling.
> >
> > Well, I think the problem is quite fundamental. Indeed I agree that
> > linux/string.h shouldn't be included. It gets pulled in because the
> > tools include <malloc.h>. Modern software really shouldn't include
> > that header anymore, and we removed it in OpenBSD some time ago. But
> > even with that fixed, things break since the same header gets pulled
> > in from <efi.h>.
> >
> > Redefining __kernel_size_t doesn't provide a way out:
> >
> > tools/mkeficapsule.c:23:16: error: typedef redefinition with different types ('size_t' (aka 'unsigned long') vs 'unsigned int')
> > typedef size_t __kernel_size_t;
> > ^
> > ./arch/arm/include/asm/posix_types.h:37:23: note: previous definition is here
> > typedef unsigned int __kernel_size_t;
> > ^
> >
> > This is on an amd64 host, so "unsigned int" clearly is the wrong type
> > for size_t.
> >
> > The fundamental problem seems to be that <efi.h> isn't safe to include
> > in a "host" tool because it includes "target" headers that
> > accidentally resolve to "system" headers on Linux systems.
> >
> > Maybe Takahiro or Heinrich have an idea how to fix that? But in the
> > meantime it would be good if building this tool would remain optional.
>
> Yes let's ask them to fix that as I agree this sounds wrong. We have
> several efi headers so perhaps just need to have the right stuff in
> each.
As far as I know, you initially introduced efi.h and efi_api.h.
What is your intent to have the two?
I think that efi_api.h contains definitions and interfaces defined
in UEFI specification for building EFI application/modules, hence
I believe that it should be target-independent. Right?
But it *includes* efi.h which also contains some definitions
defined in UEFI specification, while efi.h is only for U-Boot as
UEFI application.
I suspect that is the root cause.
Or should we thoroughly use linux headers like "efi/efi.h"
in this tool?
-Takahiro Akashi
> It is OK to have it optional with a CONFIG, but it should be enabled
> by default, otherwise no one will know it is there.
>
> Can we get the OpenBSD environment into CI or is that just too hard?
>
> Regards,
> Simon
next prev parent reply other threads:[~2021-11-05 1:04 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 6:23 [PATCH v5 00/11] efi_loader: capsule: improve capsule authentication support AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 01/11] efi_loader: capsule: drop __weak from efi_get_public_key_data() AKASHI Takahiro
2021-10-29 3:17 ` Simon Glass
2021-10-28 6:23 ` [PATCH v5 02/11] tools: mkeficapsule: add firmwware image signing AKASHI Takahiro
2021-10-29 3:17 ` Simon Glass
2021-10-29 4:56 ` AKASHI Takahiro
2021-11-02 14:56 ` Simon Glass
2021-11-02 15:13 ` Mark Kettenis
2021-11-04 2:51 ` Simon Glass
2021-11-04 14:31 ` Mark Kettenis
2021-11-04 15:11 ` Simon Glass
2021-11-04 16:51 ` Mark Kettenis
2021-11-05 2:02 ` Simon Glass
2021-11-05 8:36 ` Mark Kettenis
2021-11-05 1:04 ` AKASHI Takahiro [this message]
2021-11-05 2:02 ` Simon Glass
2021-11-05 2:35 ` AKASHI Takahiro
2021-11-05 9:35 ` AKASHI Takahiro
2021-11-08 4:55 ` AKASHI Takahiro
2021-11-15 7:50 ` AKASHI Takahiro
2021-11-08 8:46 ` AKASHI Takahiro
2021-11-04 2:59 ` AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 03/11] tools: mkeficapsule: add man page AKASHI Takahiro
2021-10-29 3:17 ` Simon Glass
2021-10-28 6:23 ` [PATCH v5 04/11] doc: update UEFI document for usage of mkeficapsule AKASHI Takahiro
2021-10-29 3:17 ` Simon Glass
2021-10-29 5:20 ` AKASHI Takahiro
2021-11-02 14:57 ` Simon Glass
2021-11-04 1:49 ` AKASHI Takahiro
2021-11-04 15:11 ` Simon Glass
2021-11-05 3:15 ` AKASHI Takahiro
2021-11-05 16:12 ` Simon Glass
2021-10-28 6:23 ` [PATCH v5 05/11] test/py: efi_capsule: add image authentication test AKASHI Takahiro
2021-10-29 3:17 ` Simon Glass
2021-10-29 5:25 ` AKASHI Takahiro
2021-11-02 14:58 ` Simon Glass
2021-11-04 2:04 ` AKASHI Takahiro
2021-11-04 2:49 ` Simon Glass
2021-11-05 1:21 ` AKASHI Takahiro
2021-11-05 2:02 ` Simon Glass
2021-11-05 3:24 ` AKASHI Takahiro
2021-11-05 16:12 ` Simon Glass
2021-11-08 4:15 ` AKASHI Takahiro
2021-11-08 15:58 ` Simon Glass
2021-10-28 6:23 ` [PATCH v5 06/11] tools: mkeficapsule: allow for specifying GUID explicitly AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 07/11] test/py: efi_capsule: align with the syntax change of mkeficapsule AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 08/11] test/py: efi_capsule: add a test for "--guid" option AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 09/11] test/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATE AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 10/11] (RFC) tools: add fdtsig.sh AKASHI Takahiro
2021-10-28 6:23 ` [PATCH v5 11/11] (RFC) efi_loader, dts: add public keys for capsules to device tree AKASHI Takahiro
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=20211105010433.GA27316@laputa \
--to=takahiro.akashi@linaro.org \
--cc=agraf@csgraf.de \
--cc=ilias.apalodimas@linaro.org \
--cc=mark.kettenis@xs4all.nl \
--cc=masami.hiramatsu@linaro.org \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/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