Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: error in backend: Cannot expand unaligned load of capability type. #313

Closed
nwf opened this issue Mar 18, 2019 · 7 comments
Closed

Comments

@nwf
Copy link
Member

nwf commented Mar 18, 2019

While attempting to build CheriBSD (revocation work atop 3158bc6a8e85394177013f0f16d84ff98350464d) with today's llvm (ab53327):

fatal error: error in backend: Cannot expand unaligned load of capability type. Created here: /mnt/mainline/cheribsd/contrib/subrepo-cheri-libunwind/src/DwarfInstructions.hpp:0
clang-9: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 9.0.0 (https://github.com/CTSRD-CHERI/llvm-project.git ab533278223efb5092a57b224b605abf1415d913)
Target: cheri-unknown-freebsd-purecap
Thread model: posix
InstalledDir: /junk/cheri-out/sdk/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-9: note: diagnostic msg:

********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/libunwind-a1a176.cpp
clang-9: note: diagnostic msg: /tmp/libunwind-a1a176.sh
clang-9: note: diagnostic msg: 

********************

*** Failed target:  libunwind.o
*** Failed command: /junk/cheri-out/sdk/bin/ccache-clang++ -integrated-as --target=cheri-unknown-freebsd -msoft-float -cheri-uintcap=offset --sysroot=/junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/tmp -fpic -cheri=128 -fvisibility=hidden -fPIC -ftls-model=initial-exec -O -pipe -G0 -mcpu=mips4 -EB -mabi=purecap -integrated-as -fpic -cheri-cap-table-abi=pcrel -Wno-deprecated-declarations -cheri=128 -mstack-alignment=16 -D__LP64__=1 -Qunused-arguments -Werror=cheri-bitwise-operations -msoft-float -I/mnt/mainline/cheribsd/contrib/subrepo-cheri-libunwind/include -I/mnt/mainline/cheribsd/lib/libgcc_eh -D_LIBUNWIND_IS_NATIVE_ONLY -cheri-cap-table-abi=pcrel -D__LP64__=1 -O2 -Qunused-arguments -Werror=cheri-bitwise-operations -g -MD -MF.depend.libunwind.o -MTlibunwind.o -nobuiltininc -idirafter /junk/cheri-out/sdk/lib/clang/9.0.0/include -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -std=c++11 -fno-rtti -Qunused-arguments -Werror=cheri-bitwise-operations -stdlib=libc++ -Wno-c++11-extensions -fno-exceptions -funwind-tables -DNDEBUG -c /mnt/mainline/cheribsd/contrib/subrepo-cheri-libunwind/src/libunwind.cpp -o libunwind.o

libunwind-a1a176.zip

@jrtc27
Copy link
Member

jrtc27 commented Mar 18, 2019

I assume this is 6bdf026; Jenkins has been reporting this failure over the weekend.

@arichardson
Copy link
Member

For now you can just revert 6bdf026 but since that causes webkit to be miscompiled it is not the ideal solution. I'll see if I can come up with a fix.

@arichardson
Copy link
Member

We could of course just always emit the CSC/CLC even if LLVM thinks it is unaligned but that might mask some other compiler bugs.

@arichardson
Copy link
Member

Minimal test case:

// RUN: %cheri_purecap_cc1 -cheri-uintcap=offset -O2 -std=c++11 -o - -S %s
extern "C" void *memcpy(void *, void *, long);

extern "C" __uintcap_t minimal_test_case(__int128 y) {
  __uintcap_t r;
  memcpy(&r, (void *)(__intcap_t)y, sizeof(r));
  return r;
}

@arichardson
Copy link
Member

Casting __int128 to void* is really odd and will crash at runtime, I wonder why this is being generated from the libunwind sources.

arichardson added a commit that referenced this issue Mar 19, 2019
…value in SROA""

Revert this for now to get CheriBSD building again until I have fixed
this properly. See #313

This reverts commit 6bdf026.
@bsdjhb
Copy link
Contributor

bsdjhb commented Mar 27, 2019

I actually want to eventually remove the memcpy and get<> template from libunwind to get us closer to upstream sources and just use a plain uintptr_t read for getP().

@arichardson
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants