Linux: infinite loop in kexec

Created on 15 Jul 2019  路  10Comments  路  Source: ClangBuiltLinux/linux

Reported internally by google production kernel team. Commenting some of the discussion here.

It seems that kexec is broken; internal teams found that definitions in arch/x86/purgatory/string.c lead to infinite recursion.

https://godbolt.org/z/grs_A9

Fixes are being discussed internally.

CrOS issue: https://bugs.chromium.org/p/chromium/issues/detail?id=984056

[ARCH] x86_64 [BUG] linux [FIXED][LINUX] 5.3

Most helpful comment

All 10 comments

I wonder if we can detect more bugs like this one with LTP.

Following the discussion CrOS #984056.

Looking at:

[ arch/x86/purgatory/Makefile ]

KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large

Instead of using -Os optimization use -O2?
Does that help?

@tpimh
Concerning LTP - are there specific testcases to check kexec?

You happen to know the testcase-name(s)?

./runltp -p -l <log file name> -f <testcase name>

It's a while I used LTP.

UPDATE: Add mini-howto

[1] https://github.com/linux-test-project/ltp/blob/master/doc/mini-howto-building-ltp-from-git.txt

I don't know specifically about kexec, but found kdump test automation suite.

Instead of using -Os optimization use -O2?
Does that help?

Clang generates the references to memcmp/memset unconditionally. We're testing a patch internally that reuses definitions from arch/x86/boot/compressed/string.c.

I've sent backports to 4.19 FWIW. Also, this was the last major issue before Google's COS kernel team could switch to clang built kernels. Now Google Cloud VM instances use clang built kernels. :zambia: :zap:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickdesaulniers picture nickdesaulniers  路  5Comments

tpgxyz picture tpgxyz  路  4Comments

nathanchance picture nathanchance  路  3Comments

tpgxyz picture tpgxyz  路  4Comments

nathanchance picture nathanchance  路  4Comments