<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - BPF target: segfault when a function has too many arguments"
href="https://bugs.llvm.org/show_bug.cgi?id=37410">37410</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>BPF target: segfault when a function has too many arguments
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ben@extrahop.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20289" name="attach_20289" title="preprocessed source">attachment 20289</a> <a href="attachment.cgi?id=20289&action=edit" title="preprocessed source">[details]</a></span>
preprocessed source
I get a segfault when I attempt to compile a function that has 6 or more
arguments.
Prior to the segfault, there's a "too many args" error emitted. I assume 6
arguments really is too many (not enough registers),
Example:
int f(void *a, void *b, void *c, void *d, void *e, void *f) {
return 0;
}
$ clang -target bpf -c bpfcrash.c -o bpfcrash.o
error: in function f i32 (i8*, i8*, i8*, i8*, i8*, i8*)defined with too many
args
0 libLLVM-3.8.so.1 0x00007f5d0b535d38
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1 libLLVM-3.8.so.1 0x00007f5d0b533fc6 llvm::sys::RunSignalHandlers() + 54
2 libLLVM-3.8.so.1 0x00007f5d0b534129
3 libc.so.6 0x00007f5d0a6704b0
4 libLLVM-3.8.so.1 0x00007f5d0ba06c99
5 libLLVM-3.8.so.1 0x00007f5d0ba2de3e
llvm::SelectionDAGISel::LowerArguments(llvm::Function const&) + 4414
6 libLLVM-3.8.so.1 0x00007f5d0ba48181
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1953
7 libLLVM-3.8.so.1 0x00007f5d0ba4967a
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1178
8 libLLVM-3.8.so.1 0x00007f5d0b67b2a2
llvm::FPPassManager::runOnFunction(llvm::Function&) + 498
9 libLLVM-3.8.so.1 0x00007f5d0b67b63b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
10 libLLVM-3.8.so.1 0x00007f5d0b67aeef
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 783
11 clang 0x00000000006eb0d3
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 4403
12 clang 0x0000000000a165a1
13 clang 0x0000000000b36f7a clang::ParseAST(clang::Sema&, bool,
bool) + 938
14 clang 0x000000000099aa0e clang::FrontendAction::Execute() + 302
15 clang 0x0000000000970406
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 278
16 clang 0x0000000000a152b3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1987
17 clang 0x00000000006b3528 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2264
18 clang 0x00000000006affbc main + 6252
19 libc.so.6 0x00007f5d0a65b830 __libc_start_main + 240
20 clang 0x00000000006b1969 _start + 41
Stack dump:
0. Program arguments: /usr/lib/llvm-3.8/bin/clang -cc1 -triple bpf
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
bpfcrash.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -dwarf-column-info
-debugger-tuning=gdb -coverage-file /home/ben/bpfcrash.o -resource-dir
/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0 -fdebug-compilation-dir /home/ben
-ferror-limit 19 -fmessage-length 348 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o bpfcrash.o -x c bpfcrash.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'bpfcrash.c'.
4. Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function
'@f'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: bpf
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/bpfcrash-25e2bd.c
clang: note: diagnostic msg: /tmp/bpfcrash-25e2bd.sh
clang: note: diagnostic msg:
********************</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>