All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage
@ 2019-04-03 19:32 Matthew Garrett
  2019-04-04 12:42 ` Jarkko Sakkinen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthew Garrett @ 2019-04-03 19:32 UTC (permalink / raw)
  To: linux-integrity
  Cc: peterhuewe, jarkko.sakkinen, jgg, roberto.sassu, linux-efi,
	tweek, Matthew Garrett, Matthew Garrett

769a8089c1fd2 (x86, efi, kasan: #undef memset/memcpy/memmove per arch)
disables the KASAN version of certain memory calls in the EFI boot stub.
tpm_eventlog.h references memcpy, so must be included after asm/efi.h in
order to allow 769a8089c1fd2 to take effect on its declarations.

Signed-off-by: Matthew Garrett <mjg59@google.com>
---
 drivers/firmware/efi/libstub/tpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index b6e93e14fcf1..777c1e82495a 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -8,9 +8,11 @@
  *     Thiebaud Weksteen <tweek@google.com>
  */
 #include <linux/efi.h>
-#include <linux/tpm_eventlog.h>
 #include <asm/efi.h>
 
+/* Must be included after asm/efi.h in order to avoid using the wrong memcpy */
+#include <linux/tpm_eventlog.h>
+
 #include "efistub.h"
 
 #ifdef CONFIG_RESET_ATTACK_MITIGATION
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage
  2019-04-03 19:32 [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage Matthew Garrett
@ 2019-04-04 12:42 ` Jarkko Sakkinen
  2019-04-04 12:51 ` Ard Biesheuvel
  2019-04-15  8:53 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2019-04-04 12:42 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, peterhuewe, jgg, roberto.sassu, linux-efi,
	tweek, Matthew Garrett

On Wed, Apr 03, 2019 at 12:32:37PM -0700, Matthew Garrett wrote:
> 769a8089c1fd2 (x86, efi, kasan: #undef memset/memcpy/memmove per arch)
> disables the KASAN version of certain memory calls in the EFI boot stub.
> tpm_eventlog.h references memcpy, so must be included after asm/efi.h in
> order to allow 769a8089c1fd2 to take effect on its declarations.
> 
> Signed-off-by: Matthew Garrett <mjg59@google.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage
  2019-04-03 19:32 [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage Matthew Garrett
  2019-04-04 12:42 ` Jarkko Sakkinen
@ 2019-04-04 12:51 ` Ard Biesheuvel
  2019-04-15  8:53 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2019-04-04 12:51 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, Peter Hüwe, Jarkko Sakkinen, jgg,
	Roberto Sassu, linux-efi, Thiebaud Weksteen, Matthew Garrett

On Wed, 3 Apr 2019 at 21:32, Matthew Garrett <matthewgarrett@google.com> wrote:
>
> 769a8089c1fd2 (x86, efi, kasan: #undef memset/memcpy/memmove per arch)
> disables the KASAN version of certain memory calls in the EFI boot stub.
> tpm_eventlog.h references memcpy, so must be included after asm/efi.h in
> order to allow 769a8089c1fd2 to take effect on its declarations.
>

I can't find any reference to memcpy in tpm_eventlog.h or tpm.h which
it includes. So can you describe the exact problem? If the issue is
due to one of the transitively included headers two levels down, then
this is fragile as hell since the same header may be included by
linux/efi.h due to, e.g.,  minor config changes.


> Signed-off-by: Matthew Garrett <mjg59@google.com>
> ---
>  drivers/firmware/efi/libstub/tpm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
> index b6e93e14fcf1..777c1e82495a 100644
> --- a/drivers/firmware/efi/libstub/tpm.c
> +++ b/drivers/firmware/efi/libstub/tpm.c
> @@ -8,9 +8,11 @@
>   *     Thiebaud Weksteen <tweek@google.com>
>   */
>  #include <linux/efi.h>
> -#include <linux/tpm_eventlog.h>
>  #include <asm/efi.h>
>
> +/* Must be included after asm/efi.h in order to avoid using the wrong memcpy */
> +#include <linux/tpm_eventlog.h>
> +
>  #include "efistub.h"
>
>  #ifdef CONFIG_RESET_ATTACK_MITIGATION
> --
> 2.21.0.392.gf8f6787159e-goog
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage
  2019-04-03 19:32 [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage Matthew Garrett
  2019-04-04 12:42 ` Jarkko Sakkinen
  2019-04-04 12:51 ` Ard Biesheuvel
@ 2019-04-15  8:53 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2019-04-15  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, peterhuewe, jgg, roberto.sassu, linux-efi,
	tweek, Matthew Garrett

On Wed, Apr 03, 2019 at 12:32:37PM -0700, Matthew Garrett wrote:
> 769a8089c1fd2 (x86, efi, kasan: #undef memset/memcpy/memmove per arch)
> disables the KASAN version of certain memory calls in the EFI boot stub.
> tpm_eventlog.h references memcpy, so must be included after asm/efi.h in
> order to allow 769a8089c1fd2 to take effect on its declarations.
> 
> Signed-off-by: Matthew Garrett <mjg59@google.com>

Applied.

/Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-15  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 19:32 [PATCH] efi: Include tpm_eventlog.h after asm/efi.h to avoid memcpy breakage Matthew Garrett
2019-04-04 12:42 ` Jarkko Sakkinen
2019-04-04 12:51 ` Ard Biesheuvel
2019-04-15  8:53 ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.