blatt A1
Go to file
Ivan Kokshaysky 17d24ff755 alpha: make stack 16-byte aligned (most cases)
commit 0a0f7362b0367634a2d5cb7c96226afc116f19c9 upstream.

The problem is that GCC expects 16-byte alignment of the incoming stack
since early 2004, as Maciej found out [1]:
  Having actually dug speculatively I can see that the psABI was changed in
 GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double
 improperly aligned)") back in Mar 2004, when the stack pointer alignment
 was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has
 various suspicious stack pointer adjustments, starting with SP_OFF which
 is not a whole multiple of 16.

Also, as Magnus noted, "ALPHA Calling Standard" [2] required the same:
 D.3.1 Stack Alignment
  This standard requires that stacks be octaword aligned at the time a
  new procedure is invoked.

However:
- the "normal" kernel stack is always misaligned by 8 bytes, thanks to
  the odd number of 64-bit words in 'struct pt_regs', which is the very
  first thing pushed onto the kernel thread stack;
- syscall, fault, interrupt etc. handlers may, or may not, receive aligned
  stack depending on numerous factors.

Somehow we got away with it until recently, when we ended up with
a stack corruption in kernel/smp.c:smp_call_function_single() due to
its use of 32-byte aligned local data and the compiler doing clever
things allocating it on the stack.

This adds padding between the PAL-saved and kernel-saved registers
so that 'struct pt_regs' have an even number of 64-bit words.
This makes the stack properly aligned for most of the kernel
code, except two handlers which need special threatment.

Note: struct pt_regs doesn't belong in uapi/asm; this should be fixed,
but let's put this off until later.

Link: https://lore.kernel.org/rcu/alpine.DEB.2.21.2501130248010.18889@angie.orcam.me.uk/ [1]
Link: https://bitsavers.org/pdf/dec/alpha/Alpha_Calling_Standard_Rev_2.0_19900427.pdf [2]

Cc: stable@vger.kernel.org
Tested-by: Maciej W. Rozycki <macro@orcam.me.uk>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Ivan Kokshaysky <ink@unseen.parts>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-21 13:50:04 +01:00
arch alpha: make stack 16-byte aligned (most cases) 2025-02-21 13:50:04 +01:00
block block: don't revert iter for -EIOCBQUEUED 2025-02-21 13:49:45 +01:00
certs
crypto crypto: api - Add crypto_clone_tfm 2024-12-14 19:53:51 +01:00
Documentation kconfig: add warn-unknown-symbols sanity check 2025-02-21 13:49:24 +01:00
drivers can: c_can: fix unbalanced runtime PM disable in error path 2025-02-21 13:50:04 +01:00
fs orangefs: fix a oob in orangefs_debug_write 2025-02-21 13:50:00 +01:00
include vrf: use RCU protection in l3mdev_l3_out() 2025-02-21 13:49:56 +01:00
init initramfs: avoid filename buffer overrun 2024-12-14 19:53:14 +01:00
io_uring io_uring/rw: commit provided buffer state on async 2025-02-21 13:49:53 +01:00
ipc ipc: fix memleak if msg_init_ns failed in create_ipc_ns 2024-12-14 19:54:06 +01:00
kernel cgroup: Remove steal time from usage_usec 2025-02-21 13:49:57 +01:00
lib maple_tree: simplify split calculation 2025-02-21 13:49:55 +01:00
LICENSES
mm mm: kmemleak: fix upper boundary check for physical address objects 2025-02-21 13:49:49 +01:00
net can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero 2025-02-21 13:50:04 +01:00
rust rust: macros: provide correct provenance when constructing THIS_MODULE 2024-10-17 15:22:24 +02:00
samples samples/landlock: Fix possible NULL dereference in parse_path() 2025-02-21 13:49:03 +01:00
scripts kbuild: Move -Wenum-enum-conversion to W=2 2025-02-21 13:49:46 +01:00
security tomoyo: don't emit warning in tomoyo_write_control() 2025-02-21 13:49:31 +01:00
sound ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V 2025-02-21 13:50:00 +01:00
tools selftests: gpio: gpio-sim: Fix missing chip disablements 2025-02-21 13:50:00 +01:00
usr
virt KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() 2024-06-27 13:46:21 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Remove *.orig pattern from .gitignore 2024-10-17 15:21:15 +02:00
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: add leah to 6.1 MAINTAINERS file 2024-05-17 11:56:16 +02:00
Makefile kbuild: switch from lz4c to lz4 for compression 2025-02-21 13:49:25 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.