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

clang-tidy 14 segfault #18

Open
Viatorus opened this issue Apr 12, 2022 · 8 comments
Open

clang-tidy 14 segfault #18

Viatorus opened this issue Apr 12, 2022 · 8 comments

Comments

@Viatorus
Copy link

Viatorus commented Apr 12, 2022

Hello,

Running clang-tidy 14 on my available systems (ubuntu 22.02, Gentoo or arch linux) results in a segfault.

clang-format 14 doesn't segfault, nor does clang-tidy 13, 12...

Any idea?

This is an extract running the program with valgrind:

==1536299== Memcheck, a memory error detector
==1536299== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1536299== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==1536299== Command: ./clang-tidy-14_linux-amd64
==1536299== Parent PID: 1534110
==1536299== 
==1536299== Syscall param set_robust_list(head) points to uninitialised byte(s)
==1536299==    at 0x1B27B95: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C2DD4E: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x42BD1D: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1FFF000417: ???
==1536299==  Address 0x4000bf0 is in the brk data segment 0x4000000-0x400123f
==1536299== 
==1536299== Conditional jump or move depends on uninitialised value(s)
==1536299==    at 0x1C62FF0: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C62FBC: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1B27D86: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C2DD4E: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x42BD1D: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1FFF000417: ???
==1536299== 
==1536299== Conditional jump or move depends on uninitialised value(s)
==1536299==    at 0x1C63074: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C62FBC: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1B27D86: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C2DD4E: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x42BD1D: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1FFF000417: ???
==1536299== 
==1536299== Conditional jump or move depends on uninitialised value(s)
==1536299==    at 0x1C68140: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1CCE1DA: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1CD2E44: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1CD60F5: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1C2DD88: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x42BD1D: ??? (in /home/user/Downloads/clang-tidy-14/clang-tidy-14_linux-amd64)
==1536299==    by 0x1FFF000417: ???
@Viatorus
Copy link
Author

@muttleyxd ?

@kuzkry
Copy link

kuzkry commented Jun 3, 2022

Hi! I forked muttleyxd's repository, bisected between v.13.0.0 and v14.0.0 and I was able to locate the first bad commit - 6a605b97a2006bd391f129a606483656b7c6fb28 as I'm not familiar with these regions of LLVM codebase. I've yet to try to understand this commit in terms of why it has such effects, but hopefully this investigation will push things further for us.

@kuzkry
Copy link

kuzkry commented Jun 16, 2022

Ok, I checked out LLVM repository on the first "wrong" commit and I noticed the following:

  • it doesn't work when compiled on Ubuntu 20.04 and executed on Manjaro
  • it works when compiled on Ubuntu 22.04 and executed on Manjaro

and Github Actions is set to Ubuntu 20.04 for this project.

But because it worked on 22.04, I suppose this problem isn't really an issue of that particular commit from LLVM. I have no idea why it happens, but the only thing that comes to my mind is differences in glibc versions. I tested it by compiling this program:

#include <gnu/libc-version.h>
#include <stdio.h>

int main()
{
  printf("glibc_release: %s\n", gnu_get_libc_release());
  printf("glibc_version: %s\n", gnu_get_libc_version());
}

which produces:

  • on Ubuntu 20.04
glibc_release: stable
glibc_version: 2.31
  • on Ubuntu 22.04
glibc_release: stable
glibc_version: 2.35
  • on Manjaro
glibc_release: stable
glibc_version: 2.35

@Viatorus
Copy link
Author

Thank you for investigating. I compiled version 14.0.5 under Ubuntu 22.04 without LTO (otherwise link time never ends) which runs quite well also under Ubuntu 22, Gentoo and Arch Linux.

Thank you again!

@2bndy5
Copy link

2bndy5 commented Aug 11, 2022

ubuntu-22.04 is now available for github runners: actions/runner-images#5998

I can confirm building clang-tidy-14 using ubuntu-22.04 in CI does fix this.

@shenxianpeng
Copy link
Contributor

shenxianpeng commented Nov 12, 2022

The latest release which includes Clang v15 still have Segmentation fault (tested on Ubuntu 20.04.5 LTS)

$ clang-tidy-15 --version
Segmentation fault

@TApplencourt
Copy link

TApplencourt commented Jul 12, 2023

I confirm that higher version of clang-tidy linux amd64 are still segfaulting

./clang-tidy-16_linux-amd64
Segmentation fault

@xgdgsc
Copy link

xgdgsc commented Nov 3, 2023

same segfault on centos 7.6

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

6 participants