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

tools/docker/syzbot: replace clang, LLVM with stable kernel archive verson #5385

Open
novitoll opened this issue Oct 10, 2024 · 0 comments
Open

Comments

@novitoll
Copy link
Contributor

novitoll commented Oct 10, 2024

Is your feature request related to a problem? Please describe.
Replace clang, llvm apt packages in syzbot Dockerfile with the stable kernel version.

Describe the solution you'd like
We could've used stable LLVM versions that kernel doc suggests? I've found that it's the most stable way rather than installing from the distro's packages.

From https://docs.kernel.org/kbuild/llvm.html:

We provide prebuilt stable versions of LLVM on kernel.org. These have been optimized with profile data for building Linux kernels, which should improve kernel build times relative to other distributions of LLVM.

Do you have any implementation in mind for this feature?

diff --git a/tools/docker/syzbot/Dockerfile b/tools/docker/syzbot/Dockerfile
index ebe856ff..6e0a4558 100644
--- a/tools/docker/syzbot/Dockerfile
+++ b/tools/docker/syzbot/Dockerfile
@@ -30,22 +30,7 @@ RUN curl https://dl.google.com/go/go1.22.7.linux-$(uname -m | sed 's/aarch64/arm
 ENV PATH /usr/local/go/bin:$PATH
 
 # The default clang-14 is too old, install the latest one.
-RUN apt-get install -y -q gnupg software-properties-common apt-transport-https
-RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN add-apt-repository "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main"
-RUN apt-get update --allow-releaseinfo-change
-RUN apt-get install -y -q --no-install-recommends llvm-15 clang-15 clang-format-15 clang-tidy-15 lld-15
-RUN apt autoremove -y -q
-RUN sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
-RUN sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
-RUN sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100
-RUN sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
-RUN sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/lld-15 100
-RUN sudo update-alternatives --install /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-15 100
-RUN sudo update-alternatives --install /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-15 100
-RUN sudo update-alternatives --install /usr/bin/llvm-objcopy llvm-objcopy /usr/bin/llvm-objcopy-15 100
-RUN sudo update-alternatives --install /usr/bin/llvm-objdump llvm-objdump /usr/bin/llvm-objdump-15 100
-RUN sudo update-alternatives --install /usr/bin/llvm-addr2line llvm-addr2line /usr/bin/llvm-addr2line-15 100
+RUN curl https://mirrors.edge.kernel.org/pub/tools/llvm/files/llvm-15.0.7-x86_64.tar.gz | tar -xzf - -C /usr/bin/
 
 # Not really GRTE, but it's enough to run some scripts that hardcode the path.
 RUN mkdir -p /usr/grte/v5/bin && ln -s /usr/bin/python3 /usr/grte/v5/bin/python2.7

Additional context
this archive contains the most of llvm utils, also llvm-readelf, llvm-strip mentioned in this PR #5367:

user@work:~/opt/llvm-14.0.6-x86_64$ ls -l
total 12
drwxr-xr-x 2 user user 4096 Oct 10 21:34 bin
drwxr-xr-x 3 user user 4096 Apr 26 23:24 include
drwxr-xr-x 3 user user 4096 Apr 26 23:24 lib
user@work:~/opt/llvm-14.0.6-x86_64$ cd bin
user@work:~/opt/llvm-14.0.6-x86_64/bin$ ls -l
total 251664
lrwxrwxrwx 1 user user         8 Apr 26 23:24 clang -> clang-14
lrwxrwxrwx 1 user user         5 Apr 26 23:24 clang++ -> clang
-rwxr-xr-x 1 user user 100523848 Apr 26 23:20 clang-14
lrwxrwxrwx 1 user user         5 Apr 26 23:24 clang-cl -> clang
lrwxrwxrwx 1 user user         5 Apr 26 23:24 clang-cpp -> clang
lrwxrwxrwx 1 user user         3 Apr 26 23:24 ld64.lld -> lld
lrwxrwxrwx 1 user user         3 Apr 26 23:24 ld.lld -> lld
-rwxr-xr-x 1 user user  78376208 Apr 26 23:20 lld
lrwxrwxrwx 1 user user         3 Apr 26 23:24 lld-link -> lld
lrwxrwxrwx 1 user user        15 Apr 26 23:24 llvm-addr2line -> llvm-symbolizer
-rwxr-xr-x 1 user user  15696696 Apr 26 23:20 llvm-ar
-rwxr-xr-x 1 user user  13322072 Apr 26 23:20 llvm-dwarfdump
-rwxr-xr-x 1 user user  16128872 Apr 26 23:20 llvm-nm
-rwxr-xr-x 1 user user   4450536 Apr 26 23:20 llvm-objcopy
-rwxr-xr-x 1 user user  16973168 Apr 26 23:20 llvm-objdump
lrwxrwxrwx 1 user user         7 Apr 26 23:24 llvm-ranlib -> llvm-ar
lrwxrwxrwx 1 user user        12 Apr 26 23:24 llvm-readelf -> llvm-readobj
-rwxr-xr-x 1 user user   6598288 Apr 26 23:21 llvm-readobj
-rwxr-xr-x 1 user user    319464 Apr 26 23:20 llvm-strings
lrwxrwxrwx 1 user user        12 Apr 26 23:24 llvm-strip -> llvm-objcopy
-rwxr-xr-x 1 user user   5293248 Apr 26 23:20 llvm-symbolizer
lrwxrwxrwx 1 user user         3 Apr 26 23:24 wasm-ld -> lld

Please let me know what you think.
CC: @tarasmadan , @dvyukov , @a-nogikh , @ramosian-glider

Downloading the archive can probably be sped up with uploading to Google drive or some another closer to the requester location.
It took me ~20 mins for 153MB

novitoll added a commit to novitoll/syzkaller that referenced this issue Oct 27, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

Fixes: google#5385
novitoll added a commit to novitoll/syzkaller that referenced this issue Oct 27, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

Fixes: google#5385
novitoll added a commit to novitoll/syzkaller that referenced this issue Oct 30, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

Fixes: google#5385
novitoll added a commit to novitoll/syzkaller that referenced this issue Nov 4, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

Fixes: google#5385
novitoll added a commit to novitoll/syzkaller that referenced this issue Nov 4, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

Fixes: google#5385
novitoll added a commit to novitoll/syzkaller that referenced this issue Nov 4, 2024
Replace clang, llvm apt packages in syzbot Dockerfile
with the stable kernel version. Reduce Dockerfile code (less RUN layers).

Use stable LLVM version that Linux kernel doc suggests [1].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/

These 2 binaries are missing in the archive: "clang-format, clang-tidy",
hence install them as the current apt package.

This patch increases syzbot docker image size by 230MB, see the
comparison between "syz_master" (current master branch built image),
and with the applied patch "syz_master_diff".

$ docker images
REPOSITORY        TAG        IMAGE ID       CREATED        SIZE
syz_master_diff   latest     40b209ef582e   6 hours ago    5.54GB
syz_master        latest     292faad84de9   13 hours ago   5.31GB

The archive is 123M size and I've built the image 3 times with removing
the images as the fresh install, and curl downloading for my 500Mbit/s
Ethernet downlink took:

1st build: 0 hour 0 min 50 sec
2nd build: 1 hour 3 min 5 sec
3rd build: 0 hour 1 min 5 sec

Hereby, I'm concerned if the archive can be mirrored from
"mirrors.edge.kernel.org" to more stable/reliable storage with more
distributed CDN like dl.google.com, or it's something local with my downlink.

Per the 3rd build, the patch also speeds up (~1 min faster) the docker image
build time:
	...
	Step 7/27 : RUN curl -L <redacted>
 ---> Running in ae2853dfc0fc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123M  100  123M    0     0  1916k      0  0:01:05  0:01:05 --:--:-- 2513k
	...
	Successfully built 387ae7e06dfa
	Successfully tagged syz_master_diff:latest

	real    6m23.013s
	user    0m0.145s
	sys     0m0.094s

and the original "syz_master" fresh build:
	...
	Successfully built 843592c9ce1b
	Successfully tagged syz_master:latest

	real    7m18.333s
	user    0m0.152s
	sys     0m0.090s

Verified the binaries' versions in the container as well:

	$ docker run --rm --name syz_master_diff -it syz_master_diff bash

	/🤖 for e in {clang,clang++,clang-tidy,clang-format,ld.lld,llvm-nm,\
	> llvm-ar,llvm-objcopy,llvm-objdump,llvm-addr2line,llvm-readelf,\
	> llvm-strip}; do echo; $e --version; done

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian clang version 15.0.6
	Target: x86_64-pc-linux-gnu
	Thread model: posix
	InstalledDir: /usr/bin

	Debian LLVM version 15.0.6
	  Optimized build.
	  Default target: x86_64-pc-linux-gnu
	  Host CPU: skylake

	Debian clang-format version 15.0.6

	ClangBuiltLinux LLD 15.0.7 (compatible with GNU linkers)

	llvm-nm, compatible with GNU nm
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-objcopy, compatible with GNU objcopy
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	  Registered Targets:
	    aarch64    - AArch64 (little endian)
	    aarch64_32 - AArch64 (little endian ILP32)
	    aarch64_be - AArch64 (big endian)
	    arm        - ARM
	    arm64      - ARM64 (little endian)
	    arm64_32   - ARM64 (little endian ILP32)
	    armeb      - ARM (big endian)
	    bpf        - BPF (host endian)
	    bpfeb      - BPF (big endian)
	    bpfel      - BPF (little endian)
	    hexagon    - Hexagon
	    mips       - MIPS (32-bit big endian)
	    mips64     - MIPS (64-bit big endian)
	    mips64el   - MIPS (64-bit little endian)
	    mipsel     - MIPS (32-bit little endian)
	    ppc32      - PowerPC 32
	    ppc32le    - PowerPC 32 LE
	    ppc64      - PowerPC 64
	    ppc64le    - PowerPC 64 LE
	    riscv32    - 32-bit RISC-V
	    riscv64    - 64-bit RISC-V
	    systemz    - SystemZ
	    thumb      - Thumb
	    thumbeb    - Thumb (big endian)
	    x86        - 32-bit X86: Pentium-Pro and above
	    x86-64     - 64-bit X86: EM64T and AMD64

	llvm-addr2line
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

	llvm-strip, compatible with GNU strip
	LLVM (http://llvm.org/):
	  LLVM version 15.0.7
	  Optimized build.
	  Default target: x86_64-unknown-linux-gnu
	  Host CPU: skylake

Fixes: google#5385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant