From: Kees Cook <keescook@chromium.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Guenter Roeck <linux@roeck-us.net>, Peter Rosin <peda@axentia.se>,
Andy Shevchenko <andy@kernel.org>,
Matteo Croce <mcroce@microsoft.com>,
Nathan Chancellor <nathan@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
llvm@lists.linux.dev, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] lib/test_string.c: Add test for strlen()
Date: Thu, 3 Feb 2022 12:45:36 -0800 [thread overview]
Message-ID: <202202031242.45A7F5704@keescook> (raw)
In-Reply-To: <CAKwvOdnJ3w2Jb9tBZ+JnEfviquj2WktemCd833f=_P66a0qVag@mail.gmail.com>
On Thu, Feb 03, 2022 at 11:50:34AM -0800, Nick Desaulniers wrote:
> The kernel does not link against a libc; but it does provide many
> symbols that libc would provide, with the same or similar enough
> semantics that I would strongly recommend we _don't_ use
> -ffreestanding in order to get such libcall optimizations (there are a
> lot; see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
> for some examples) and simply use -fno-builtin-* when necessary, or
> fix the kernel implementations individually.
Right, we really don't want -ffreestanding. Rather, we want to not link
against libgcc. This is mostly true already, though some of the smaller
architectures still do:
$ git grep print-libgcc
arch/arc/Makefile:LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
arch/csky/Makefile: $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
arch/h8300/boot/compressed/Makefile:LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null)
arch/nios2/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
arch/openrisc/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
arch/parisc/Makefile:LIBGCC := $(shell $(CC) -print-libgcc-file-name)
arch/xtensa/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
arch/xtensa/boot/boot-redboot/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
--
Kees Cook
prev parent reply other threads:[~2022-02-03 20:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-30 18:36 [PATCH] lib/test_string.c: Add test for strlen() Kees Cook
2022-01-30 18:56 ` Andy Shevchenko
2022-01-30 20:34 ` Kees Cook
2022-01-30 20:13 ` kernel test robot
2022-01-30 20:13 ` kernel test robot
2022-01-30 20:35 ` Kees Cook
2022-01-30 20:35 ` Kees Cook
2022-02-02 16:01 ` Guenter Roeck
2022-02-02 16:16 ` Andy Shevchenko
2022-02-02 20:52 ` Kees Cook
2022-02-02 23:12 ` Guenter Roeck
2022-02-03 8:04 ` Geert Uytterhoeven
2022-02-03 16:41 ` Kees Cook
2022-02-03 17:15 ` Kees Cook
2022-02-03 18:09 ` Geert Uytterhoeven
2022-02-03 19:50 ` Nick Desaulniers
2022-02-03 20:25 ` Kees Cook
2022-02-03 20:45 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202202031242.45A7F5704@keescook \
--to=keescook@chromium.org \
--cc=andy@kernel.org \
--cc=geert@linux-m68k.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=mcroce@microsoft.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peda@axentia.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.