Home | History | Annotate | Download | only in conf
History log of /src/sys/arch/aarch64/conf/Makefile.aarch64
RevisionDateAuthorComments
 1.25  28-Jul-2023  rin Simplify fix for PR toolchain/57146

Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.
 1.24  26-Jul-2023  rin Fix kernel size inflation for arm and aarch64 (PR toolchain/57146)

For some conditions, SYSTEM_LD_TAIL is set for arm and aarch64.
Then, ctfmerge(1) in default SYSTEM_LD_TAIL is unintentionally
skipped, which results in the catastrophic kernel size inflation,
as reported in the PR.

Also, introduce and use OBJCOPY_STRIPFLAGS variable instead of
STRIPFLAGS, as strip(1) is replaced by objcopy(1) during MI
kernel build procedure.

XXX
For Makefile.{arm,aarch64}, weird logic is used to determine how
to handle debug symbols; MKDEBUG{,KERNEL} are taken into account
later in sys/conf/Makefile.kern.inc.
 1.23  27-May-2021  ryo branches: 1.23.12;
In gcc10, -msign-return-address is no longer supported.
Instead, (LLVM-compatible) -mbranch-protection option is supported.
 1.22  10-Feb-2021  ryo branches: 1.22.4; 1.22.6;
add support kernel profiling on aarch64

- add MCOUNT_ENTER, MCOUNT_EXIT macro
- __mcount() function should be aligned
- add "-fno-optimize-sibling-calls" option when PROF. for accurate profiling, it is better to suppress the tail call.
 1.21  11-May-2020  ryo branches: 1.21.2;
"options ARMV83_PAC" is now supported for gcc as well.

- add "-msign-return-address=all" to CFLAGS for gcc when specified options ARMV83_PAC
- AARCH64REG_{READ,WRITE}_INLINE3 macro can now use the APIAKey registers in both gcc and llvm.
llvm requires asm(".arch armv8.3-a"), whereas gcc requires __attribute__((target("arch=armv8.3-a"))).
- use ".arch armv8.3-a" rather than ".arch armv8.3-a+pac" in *.S for llvm.
 1.20  13-Apr-2020  maxv Add KASAN instrumentation on on-stack VLAs, same as amd64.
 1.19  13-Apr-2020  maxv Add support for Branch Target Identification (BTI).

On the executable pages that have the GP (Guarded Page) bit, the semantic
of the "br" and "blr" instructions is changed: the CPU expects the first
instruction of the jump/call target to be "bti", and faults if it isn't.

We add the GP bit on the kernel .text pages (and incidentally the .rodata
pages, but we don't care). The compiler adds a "bti c" instruction at the
beginning of each C function. We modify the ENTRY() macros to manually add
"bti c" in the asm functions.

cpuswitch.S needs a specific change: with "br x27" the CPU expects "bti j",
which is bad because the functions begin with "bti c"; switch to "br x16",
for the CPU to accept "bti c".

BTI helps defend against JOP/COP. Tested on Qemu.
 1.18  12-Apr-2020  maxv Add support for Pointer Authentication (PAC).

We use the "pac-ret" option, to sign the return instruction pointer on
function entry, and authenticate it on function exit. This acts as a
mitigation against ROP.

The authentication uses a per-lwp (secret) I-A key stored in the 128bit
APIAKey register and part of the lwp context. During lwp creation, the
kernel generates a random key, and during context switches, it installs
the key of the target lwp on the CPU.

Userland cannot read the APIAKey register directly. However, it can sign
its pointers with it, because the register is architecturally shared
between userland and the kernel. Although part of the CPU design, it is
a bit of an undesired behavior, because it allows to forge valid kernel
pointers from userland. To avoid that, we don't share the key with
userland, and rather switch it in EL0<->EL1 transitions. This means that
when userland executes, a different key is loaded in APIAKey than the one
the kernel uses. For now the userland key is a fixed 128bit zero value.

The DDB stack unwinder is changed to strip the authentication code from
the pointers in lr.

Two problems are known:

* Currently the idlelwps' keys are not really secret. This is because
the RNG is not yet available when we spawn these lwps. Not overly
important, but would be nice to fix with UEFI RNG.
* The key switching in EL0<->EL1 transitions is not the most optimized
code on the planet. Instead of checking aarch64_pac_enabled, it would
be better to hot-patch the code at boot time, but there currently is
no hot-patch support on aarch64.

Tested on Qemu.
 1.17  04-Mar-2020  ryo branches: 1.17.2;
change kernel vm base address to use more than 256GB of memory. (up to 64TB)

also enlarge KSEG(direct map) region from 512GB to 64TB.
KASAN works ok.

Note: -fasan-shadow-offset=
KASAN_SHADOW_START - (CANONICAL_BASE >> 3) =
0xFFFF400000000000 - (0xFFFF000000000000 >> 3) =
0xDFFF600000000000
 1.16  04-Dec-2019  jmcneill Fix alignment of .text section by changing load address to
0xffffffc000000000 and adding 64 bytes of padding before the entry point.
 1.15  03-Mar-2019  maxv branches: 1.15.4;
Add KASAN use-after-scope detection in aarch64, tested by Ryo Shimizu,
thanks.
 1.14  08-Nov-2018  maxv Track the stack with kASan on aarch64. Same principle as on amd64. Illegal
accesses occurring there are now detected.

Originally written by me, but reworked by ryo@, thanks.
 1.13  01-Nov-2018  maxv Add kASan support for aarch64. Stack tracking needs more investigation
and will come in a separate commit.

Reviewed by ryo@ jmcneill@ skrll@.
 1.12  22-Sep-2018  rin - Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
 1.11  14-Sep-2018  skrll s/A64/ARM/

no functional change
 1.10  23-Jun-2018  jakllsch branches: 1.10.2;
locore.S is a MD_SFILES.

This keeps the dependency handling in the loop, so rebuilds after
changing options, say EARLYCONS, don't fail.
 1.9  01-Apr-2018  ryo Add initial support for ARMv8 (AARCH64) (by nisimura@ and ryo@)

- sys/arch/evbarm64 is gone and integrated into sys/arch/evbarm. (by skrll@)
- add support fdt. evbarm/conf/GENERIC64 fdt (bcm2837,sunxi,tegra) based generic 64bit kernel config. (by skrll@, jmcneill@)
 1.8  10-Dec-2017  christos branches: 1.8.2;
- Allow multiple .BEGIN targets
- Make their protection consistent
 1.7  05-May-2016  rjs Fix config(1) errors and warnings.

Set up arm headers for the build.
 1.6  24-Aug-2015  uebayasi Define ${LINKSCRIPT} in one place.
 1.5  20-Aug-2015  uebayasi Use ${KERNLDSCRIPT}.
 1.4  15-Nov-2014  uebayasi branches: 1.4.2;
Use LINKSCRIPT.
 1.3  17-Aug-2014  joerg branches: 1.3.2;
Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
 1.2  14-Aug-2014  joerg Use wildcards for stripping/preserving the mapping symbols on ARM and
AArch64. LLVM creates unique symbols in each file of the form $a.n etc.
 1.1  10-Aug-2014  matt branches: 1.1.2;
Preliminary files for AARCH64 (64-bit ARM) support.
Enough for a distribution build.
 1.1.2.1  05-Jan-2016  snj Pull up following revision(s) (requested by martin in ticket #1058):
sys/arch/arm/conf/Makefile.arm: revision 1.43
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.2
share/mk/bsd.sys.mk: revision 1.243, 1.244
Use wildcards for stripping/preserving the mapping symbols on ARM and
AArch64. LLVM creates unique symbols in each file of the form $a.n etc.
--
Fix typo in OBJCOPYLIBFLAGS_EXTRA for aarch64eb.
 1.3.2.3  03-Dec-2017  jdolecek update from HEAD
 1.3.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.2.1  17-Aug-2014  tls file Makefile.aarch64 was added on branch tls-maxphys on 2014-08-20 00:02:39 +0000
 1.4.2.2  29-May-2016  skrll Sync with HEAD
 1.4.2.1  22-Sep-2015  skrll Sync with HEAD
 1.8.2.4  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.8.2.3  30-Sep-2018  pgoyette Ssync with HEAD
 1.8.2.2  25-Jun-2018  pgoyette Sync with HEAD
 1.8.2.1  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.10.2.3  21-Apr-2020  martin Sync with HEAD
 1.10.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.1  10-Jun-2019  christos Sync with HEAD
 1.15.4.1  09-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #525):

external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c: revision 1.1
distrib/sets/lists/modules/md.i386: revision 1.83
share/mk/bsd.own.mk: revision 1.1168
usr.bin/mkubootimage/mkubootimage.c: revision 1.25
sys/modules/dtrace/Makefile: revision 1.7
usr.bin/mkubootimage/mkubootimage.c: revision 1.26
sys/modules/dtrace/Makefile: revision 1.8
external/cddl/osnet/dist/lib/libdtrace/aarch64/dt_isadep.c: revision 1.2
distrib/sets/lists/modules/mi: revision 1.128
sys/arch/aarch64/include/frame.h: revision 1.3
sys/arch/evbarm/conf/mk.generic64: revision 1.4
external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c: revision 1.12
sys/modules/cyclic/Makefile: revision 1.4
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.16
external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c: revision 1.1
sys/arch/aarch64/aarch64/start.S: revision 1.3
sys/arch/aarch64/aarch64/trap.c: revision 1.22
external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.1
external/cddl/osnet/dev/dtrace/aarch64/dtrace_asm.S: revision 1.1
external/cddl/osnet/dev/fbt/aarch64/fbt_isa.h: revision 1.1
external/cddl/osnet/dev/dtrace/aarch64/regset.h: revision 1.1
external/cddl/osnet/lib/libdtrace/Makefile: revision 1.26
distrib/sets/lists/modules/md.amd64: revision 1.82
usr.bin/mkubootimage/mkubootimage.1: revision 1.13
distrib/sets/lists/modules/ad.arm: revision 1.14

Add KDTRACE_HOOKS support.

Define lwp_trapframe() macro

dtrace: add support for aarch64

Add syscall_linux back for other arm architectures (accidently removed
in previous)

Add -u flag for updating headers in place.

Fix alignment of .text section by changing load address to
0xffffffc000000000 and adding 64 bytes of padding before the entry point.

Update arm64 image header in place

Move dtrace_syscall_linux out of mi set list

Enable DTrace on aarch64

Fix signed/unsigned comparison
 1.17.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.21.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.22.6.1  31-May-2021  cjep sync with head
 1.22.4.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.23.12.1  11-Sep-2023  martin Pull up following revision(s) (requested by rin in ticket #363):

sys/arch/aarch64/conf/Makefile.aarch64: revision 1.24
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.25
sys/arch/shark/conf/Makefile.shark.inc: revision 1.28
sys/arch/alpha/conf/Makefile.alpha: revision 1.88
sys/arch/mips/conf/Makefile.mips: revision 1.73
sys/conf/Makefile.kern.inc: revision 1.298
sys/conf/Makefile.kern.inc: revision 1.299
sys/arch/cats/conf/Makefile.cats.inc: revision 1.37
sys/arch/arm/conf/Makefile.arm: revision 1.56
sys/arch/arm/conf/Makefile.arm: revision 1.57
sys/arch/riscv/conf/Makefile.riscv: revision 1.10

Always use arm-elf2aout; no a.out support both for binutils{,.old}

Fix kernel size inflation for arm and aarch64 (PR toolchain/57146)

For some conditions, SYSTEM_LD_TAIL is set for arm and aarch64.
Then, ctfmerge(1) in default SYSTEM_LD_TAIL is unintentionally
skipped, which results in the catastrophic kernel size inflation,
as reported in the PR.

Also, introduce and use OBJCOPY_STRIPFLAGS variable instead of
STRIPFLAGS, as strip(1) is replaced by objcopy(1) during MI
kernel build procedure.

For Makefile.{arm,aarch64}, weird logic is used to determine how
to handle debug symbols; MKDEBUG{,KERNEL} are taken into account
later in sys/conf/Makefile.kern.inc.

Use OBJCOPY_STRIPFLAGS instead of STRIPFLAGS.
Simplify fix for PR toolchain/57146

Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.

RSS XML Feed