Re: Very slow clang kernel config ..

From: Adrian Bunk
Date: Sun May 02 2021 - 05:36:41 EST


On Sat, May 01, 2021 at 09:32:25AM -0700, Linus Torvalds wrote:
>...
> Yes, it can save on disk use, but unless it's some very core library
> used by a lot of things (ie particularly things like GUI libraries
> like gnome or Qt or similar), the disk savings are often not all that
> big - and disk is cheap. And the memory savings are often actually
> negative (again, unless it's some big library that is typically used
> by lots of different programs at the same time).
>...
> I think people have this incorrect picture that "shared libraries are
> inherently good". They really really aren't. They cause a lot of
> problems, and the advantage really should always be weighed against
> those (big) disadvantages.
>...

Disk and memory usage is not the biggest advantage.

The biggest advantage of shared libraries is that they enable
distributions to provide security fixes.

Distributions try hard to have only one place to patch and one package
to rebuild when a CVE has to be fixed.

It is not feasible to rebuild all users of a library in a
distribution every time a CVE gets published for a library.

Some of the new language ecosystems like Go or Rust do not offer
shared libraries.

At the end of this email are some of the recent CVEs in Rust.

Q:
What happens if you use a program provided by your distribution that is
written in Rust and handles untrusted input in a way that it might be
vulnerable to exploits based on one of these CVEs?

A:
The program has a known vulnerability that will likely stay unfixed.

This is of course not a problem for the rare software like Firefox or
the kernel that have CVEs themselves so regularly that they get rebuilt
all the time.

> Linus

cu
Adrian


CVE-2020-36317 In the standard library in Rust before 1.49.0,
String::retain() function has a panic safety problem. It allows creation
of a non-UTF-8 Rust string when the provided closure panics. This bug
could result in a memory safety violation when other string APIs assume
that UTF-8 encoding is used on the same string.

CVE-2020-36318 In the standard library in Rust before 1.49.0,
VecDeque::make_contiguous has a bug that pops the same element more than
once under certain condition. This bug could result in a use-after-free
or double free.

CVE-2020-36323 In the standard library in Rust before 1.52.0, there is
an optimization for joining strings that can cause uninitialized bytes
to be exposed (or the program to crash) if the borrowed string changes
after its length is checked.

CVE-2021-28875 In the standard library in Rust before 1.50.0,
read_to_end() does not validate the return value from Read in an unsafe
context. This bug could lead to a buffer overflow.

CVE-2021-31162 In the standard library in Rust before 1.53.0, a double
free can occur in the Vec::from_iter function if freeing the element
panics.