mbox series

[0/2] Introduce macros for the offsets to reserved_pg_dir and tramp_pg_dir

Message ID 20210202123658.22308-1-joey.gouly@arm.com (mailing list archive)
Headers show
Series Introduce macros for the offsets to reserved_pg_dir and tramp_pg_dir | expand

Message

Joey Gouly Feb. 2, 2021, 12:36 p.m. UTC
Make the offsets to reserved_pg_dir and tramp_pg_dir less fragile by
introducing macros that contain their offsets.

Also use these macros to verify the offsets at link time.

Joey Gouly (2):
  arm64: vmlinux.ld.S: add assertion for reserved_pg_dir offset
  arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset

 arch/arm64/include/asm/asm-uaccess.h |  4 ++--
 arch/arm64/include/asm/memory.h      | 12 ++++++++++++
 arch/arm64/include/asm/uaccess.h     |  2 +-
 arch/arm64/kernel/entry.S            |  4 ++--
 arch/arm64/kernel/vmlinux.lds.S      |  8 ++++++++
 5 files changed, 25 insertions(+), 5 deletions(-)

Comments

Mark Rutland Feb. 3, 2021, 12:28 p.m. UTC | #1
On Tue, Feb 02, 2021 at 12:36:56PM +0000, Joey Gouly wrote:
> Make the offsets to reserved_pg_dir and tramp_pg_dir less fragile by
> introducing macros that contain their offsets.
> 
> Also use these macros to verify the offsets at link time.

I like the idea, the implementation appears to be correct, both patches
build and boot without issue, and if I mess with the offsets I get the
expected warnings. So, for both patches:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> 
> Joey Gouly (2):
>   arm64: vmlinux.ld.S: add assertion for reserved_pg_dir offset
>   arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset
> 
>  arch/arm64/include/asm/asm-uaccess.h |  4 ++--
>  arch/arm64/include/asm/memory.h      | 12 ++++++++++++
>  arch/arm64/include/asm/uaccess.h     |  2 +-
>  arch/arm64/kernel/entry.S            |  4 ++--
>  arch/arm64/kernel/vmlinux.lds.S      |  8 ++++++++
>  5 files changed, 25 insertions(+), 5 deletions(-)
> 
> -- 
> 2.17.1
>
Will Deacon Feb. 3, 2021, 9:31 p.m. UTC | #2
On Tue, 2 Feb 2021 12:36:56 +0000, Joey Gouly wrote:
> Make the offsets to reserved_pg_dir and tramp_pg_dir less fragile by
> introducing macros that contain their offsets.
> 
> Also use these macros to verify the offsets at link time.
> 
> Joey Gouly (2):
>   arm64: vmlinux.ld.S: add assertion for reserved_pg_dir offset
>   arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset
> 
> [...]

Applied to arm64 (for-next/misc), thanks!

[1/2] arm64: vmlinux.ld.S: add assertion for reserved_pg_dir offset
      https://git.kernel.org/arm64/c/00ef54341936
[2/2] arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset
      https://git.kernel.org/arm64/c/0188a894c390

Cheers,