public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
	Guillem Jover <[email protected]>,
	Jeff Moyer <[email protected]>,
	Stefan Hajnoczi <[email protected]>,
	Michael William Jonathan <[email protected]>,
	Matthew Patrick <[email protected]>,
	io-uring Mailing List <[email protected]>,
	Linux Kernel Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [RFC PATCH liburing v1 2/3] configure: Introduce '--use-libc' option
Date: Fri, 23 Jun 2023 00:20:28 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Currently, when compiling liburing on x86, x86-64, and aarch64
architectures, the resulting binary lacks the linkage with the standard
C library (libc).

To address the concerns raised by Linux distribution package maintainers
regarding security, it is necessary to enable the linkage of libc to
liburing. Especially right now, when the security of io_uring is being
scrutinized. By incorporating the '--use-libc' option, developers can
now enhance the overall hardening of liburing by utilizing compiler
features such as the stack protector and address sanitizer.

Link: https://security.googleblog.com/2023/06/learnings-from-kctf-vrps-42-linux.html
Link: https://lore.kernel.org/io-uring/20230621100447.GD2667602@fedora
Link: https://lore.kernel.org/io-uring/[email protected]
Cc: Stefan Hajnoczi <[email protected]>
Cc: Guillem Jover <[email protected]>
Co-authored-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
 configure | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index a16ffca83d678364..46afb7285a1ea8d0 100755
--- a/configure
+++ b/configure
@@ -26,6 +26,8 @@ for opt do
   ;;
   --cxx=*) cxx="$optarg"
   ;;
+  --use-libc) use_libc=yes
+  ;;
   *)
     echo "ERROR: unknown option $opt"
     echo "Try '$0 --help' for more information"
@@ -73,6 +75,7 @@ Options: [defaults in brackets after descriptions]
   --datadir=PATH           install shared data in PATH [$datadir]
   --cc=CMD                 use CMD as the C compiler
   --cxx=CMD                use CMD as the C++ compiler
+  --use-libc               use libc for liburing (useful for hardening)
 EOF
 exit 0
 fi
@@ -382,10 +385,13 @@ fi
 print_config "NVMe uring command support" "$nvme_uring_cmd"
 
 #############################################################################
-#
-# Currently, CONFIG_NOLIBC is only enabled on x86-64, x86 (32-bit) and aarch64.
-#
-cat > $TMPC << EOF
+liburing_nolibc="no"
+if test "$use_libc" != "yes"; then
+
+  #
+  # Currently, CONFIG_NOLIBC only supports x86-64, x86 (32-bit) and aarch64.
+  #
+  cat > $TMPC << EOF
 int main(void){
 #if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
   return 0;
@@ -394,10 +400,13 @@ int main(void){
 #endif
 }
 EOF
-if compile_prog "" "" "nolibc support"; then
-  liburing_nolibc="yes"
+
+  if compile_prog "" "" "nolibc"; then
+    liburing_nolibc="yes"
+  fi
 fi
-print_config "nolibc support" "$liburing_nolibc";
+
+print_config "nolibc" "$liburing_nolibc";
 #############################################################################
 
 ####################################################
-- 
Ammar Faizi


  parent reply	other threads:[~2023-06-22 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 17:20 [RFC PATCH liburing v1 0/3] Introduce '--use-libc' option Ammar Faizi
2023-06-22 17:20 ` [RFC PATCH liburing v1 1/3] configure: Remove --nolibc option Ammar Faizi
2023-06-22 17:20 ` Ammar Faizi [this message]
2023-06-22 17:20 ` [RFC PATCH liburing v1 3/3] src/Makefile: Allow using stack protector with libc Ammar Faizi
2023-06-22 17:57   ` Thomas Weißschuh
2023-06-22 22:49     ` Ammar Faizi
2023-06-23 22:13 ` [RFC PATCH liburing v1 0/3] Introduce '--use-libc' option Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox