rust-lang / rust-lang/rustc_codegen_gcc

std-tests sometime segfault

Open
#245 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
1.2k
Forks
105
Avg merge
8h 20m
Merged PRs (30d)
14

Description

Can reproduce locally by running the following command in an infinite loop:

./test.sh --std-tests

Gdb output:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  lookup_page_table_entry (p=0xfa91b8780000001e) at /gcc-repo/gcc-build/build/../../gcc/gcc/ggc-page.cc:630

warning: Source file is more recent than executable.
630	  while (table->high_bits != high_bits)
=> 0x00007f9e5d08308b <_Z12ggc_set_markPKv+43>:	48 3b 48 08	cmp    rcx,QWORD PTR [rax+0x8]
   0x00007f9e5d08308f <_Z12ggc_set_markPKv+47>:	75 f7	jne    0x7f9e5d083088 <_Z12ggc_set_markPKv+40>
[Current thread is 1 (Thread 0x7f9e531ff6c0 (LWP 444345))]
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /rustc_codegen_gcc/target/debug/librustc_codegen_gcc.so.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) p table
$1 = (page_table) 0x0
(gdb) list
625	#if HOST_BITS_PER_PTR <= 32
626	  base = &G.lookup[0];
627	#else
628	  page_table table = G.lookup;
629	  uintptr_t high_bits = (uintptr_t) p & ~ (uintptr_t) 0xffffffff;
630	  while (table->high_bits != high_bits)
631	    table = table->next;
632	  base = &table->table[0];
633	#endif

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with ./test.sh --std-tests in an infinite loop, then inspect lookup_page_table_entry in gcc/gcc/ggc-page.cc around line 630 and ggc_set_mark. Use the supplied GDB output to investigate why the page table is null; done means the standard tests no longer intermittently segfault.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.