public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Andrew Scull <ascull@google.com>
Cc: sjg@chromium.org, seanga2@gmail.com, u-boot@lists.denx.de
Subject: Re: [PATCH 01/11] sandbox: Set the EFI symbols in linker script
Date: Tue, 12 Apr 2022 00:15:15 +0200	[thread overview]
Message-ID: <1c79cb39-35ea-db00-bec4-91be603f6c19@gmx.de> (raw)
In-Reply-To: <20220407094123.1752236-2-ascull@google.com>

On 4/7/22 11:41, Andrew Scull wrote:
> The sandbox doesn't populate the EFI lists so explicitly set the list
> start and end symbols to indicate that the lists are empty. This
> simplifies the linker scripts, removed references to non-existant
> sections and removes '.' prefixed sections that conflicted with clang's
> ASAN.


In u-boot.map I see:

10636  .text.efi_runtime
10637                 0x00000000000df50a      0x72d
/tmp/cctuEBRS.ltrans19.ltrans.o
10638                 0x00000000000df50a                efi_get_time
10639                 0x00000000000df519                efi_set_time
10640                 0x00000000000df528
efi_unimplemented.lto_priv.0
10641                 0x00000000000df54a
efi_update_capsule_unsupported
10642                 0x00000000000df559
efi_query_capsule_caps_unsupported

So there are definively functions that should go between
__efi_runtime_start and __efi_runtime_stop.

If ._efi_runtime_start == .__efi_runtime_stop, there is a bug in the
linker script. Deleting the symbols is the wrong way to deal with this
deficiency. Instead ensure correct placement of the functions marked as
__efi_runtime and the data marked as __efi_runtime_data.

Best regards

Heinrich

>
> Signed-off-by: Andrew Scull <ascull@google.com>
> ---
>   arch/sandbox/cpu/u-boot.lds | 32 +++++---------------------------
>   arch/sandbox/lib/Makefile   |  2 +-
>   arch/sandbox/lib/sections.c | 13 -------------
>   3 files changed, 6 insertions(+), 41 deletions(-)
>   delete mode 100644 arch/sandbox/lib/sections.c
>
> diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
> index 6d710618f5..dd675cc3d2 100644
> --- a/arch/sandbox/cpu/u-boot.lds
> +++ b/arch/sandbox/cpu/u-boot.lds
> @@ -19,33 +19,11 @@ SECTIONS
>   		*(.u_boot_sandbox_getopt_end)
>   	}
>
> -	.__efi_runtime_start : {
> -		*(.__efi_runtime_start)
> -	}
> -
> -	.efi_runtime : {
> -		*(efi_runtime_text)
> -		*(efi_runtime_data)
> -	}
> -
> -	.__efi_runtime_stop : {
> -		*(.__efi_runtime_stop)
> -	}
> -
> -	.efi_runtime_rel_start :
> -	{
> -		*(.__efi_runtime_rel_start)
> -	}
> -
> -	.efi_runtime_rel : {
> -		*(.relefi_runtime_text)
> -		*(.relefi_runtime_data)
> -	}
> -
> -	.efi_runtime_rel_stop :
> -	{
> -		*(.__efi_runtime_rel_stop)
> -	}
> +	/* Sandbox has empty EFI runtime lists. */
> +	__efi_runtime_start = .;
> +	__efi_runtime_stop = __efi_runtime_start;
> +	__efi_runtime_rel_start = .;
> +	__efi_runtime_rel_stop = __efi_runtime_rel_start;
>
>   	.dynsym :
>   	{
> diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
> index a2bc5a7ee6..05f06180f8 100644
> --- a/arch/sandbox/lib/Makefile
> +++ b/arch/sandbox/lib/Makefile
> @@ -5,7 +5,7 @@
>   # (C) Copyright 2002-2006
>   # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
>
> -obj-y	+= fdt_fixup.o interrupts.o sections.o
> +obj-y	+= fdt_fixup.o interrupts.o
>   obj-$(CONFIG_PCI)	+= pci_io.o
>   obj-$(CONFIG_CMD_BOOTM) += bootm.o
>   obj-$(CONFIG_CMD_BOOTZ) += bootm.o
> diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c
> deleted file mode 100644
> index 2559eeea38..0000000000
> --- a/arch/sandbox/lib/sections.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
> - *
> - */
> -#include <linux/compiler.h>
> -
> -char __efi_runtime_start[0] __section(".__efi_runtime_start");
> -char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
> -char __efi_runtime_rel_start[0]
> -		__section(".__efi_runtime_rel_start");
> -char __efi_runtime_rel_stop[0]
> -		__section(".__efi_runtime_rel_stop");


  parent reply	other threads:[~2022-04-11 22:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  9:41 [PATCH 00/11] Fuzzing and ASAN for sandbox Andrew Scull
2022-04-07  9:41 ` [PATCH 01/11] sandbox: Set the EFI symbols in linker script Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-11 22:15   ` Heinrich Schuchardt [this message]
2022-04-11 22:37     ` Andrew Scull
2022-04-07  9:41 ` [PATCH 02/11] sandbox: Migrate getopt section to linker list Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 03/11] linker_lists: Rename sections to remove . prefix Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 04/11] sandbox: Add support for Address Sanitizer Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-12  9:26     ` Andrew Scull
2022-04-07  9:41 ` [PATCH 05/11] fuzzing_engine: Add fuzzing engine uclass Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 06/11] test: fuzz: Add framework for fuzzing Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 07/11] sandbox: Decouple program entry from sandbox init Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 08/11] sandbox: Add libfuzzer integration Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-07  9:41 ` [PATCH 09/11] sandbox: Implement fuzzing engine driver Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-14 13:44     ` Andrew Scull
2022-04-07  9:41 ` [PATCH 10/11] fuzz: virtio: Add fuzzer for vring Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-12 14:04     ` Andrew Scull
2022-04-07  9:41 ` [PATCH 11/11] RFC: Hack dlmalloc to poison memory Andrew Scull
2022-04-11 18:35   ` Simon Glass
2022-04-12 10:19     ` Andrew Scull

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=1c79cb39-35ea-db00-bec4-91be603f6c19@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=ascull@google.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.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