Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11604371rwd; Thu, 22 Jun 2023 16:05:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7S6pbJ0shAgknnSxA7erUeu0UNKGw3lobsjkp3TbhDhUESxRFCxKiL+x791ZB5hB11u8XJ X-Received: by 2002:a05:6a00:1309:b0:662:2b1c:be80 with SMTP id j9-20020a056a00130900b006622b1cbe80mr13972858pfu.28.1687475121068; Thu, 22 Jun 2023 16:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687475121; cv=none; d=google.com; s=arc-20160816; b=uinP1aHqZVpE9uA+K35ahe9I3TUpJwb6RmAufJIbLfDzoGdHUgVp4N9s35iBD/TlQp EtLhVAiQd+SLYEXfePpyCrQaPK5lVc2780pvWM0lmSVjszhx0HKnycaofvcSz9tfvrX3 KaMu3kqq2zYqtX5u+wGEwWZBHv73ddl2hk79Edt6gcUnMwqGK1TrI3HEUOlJOJWrEdci ToYEvFGYxNZfw9PpTF1nAsPbOEty29FCKgZGPeEiMR1C8Mzo09vR0J0ptWa6K65rtDwu 7z2O3iJSgyurjWRp/J0ryMCPeqcuWBehmSDRyzbpf5wUBQZlEklNzb+6sdjhQp6vPDHo epzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3T0FrfT1GfjgXstHXtzwpln6CufyY5SLo76NvqBMQC0=; b=TH1JV/mQyV7S31T/8vf3HSndcewWQHofAFl4dQ7+6GhvEoPqLTX/6Dnam+sJNxtFqg +7sBxpDFR2nWJ6EyVxYK9kmCFnvljKU5ctkLluPIPTy3XVKpDZLlM2QzJb4WH3xhnjo2 8bLDCNBDXk98gjouM/85OYgYZsB8UwaSspKPyWn6WuLm0fkoenCbzC80W4bTigOfDDLk FQZHdC9bBkEbu3ryrjg1sfp6K/29p9wafH1kZg3eCe++MH8/PjuAEuudLFkpbqkm+8zy Gnh/GYIL5UuQC5b/BgaMfXwofJEQozmaIm2Fx4CBcVAr5zjxseSnbZdhKXypzIjybpPl sWlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=ZO4RrMe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a056a001d8d00b006562b3c3c33si2354177pfw.78.2023.06.22.16.05.08; Thu, 22 Jun 2023 16:05:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=ZO4RrMe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbjFVWuA (ORCPT + 99 others); Thu, 22 Jun 2023 18:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbjFVWt7 (ORCPT ); Thu, 22 Jun 2023 18:49:59 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFE21BD3; Thu, 22 Jun 2023 15:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1687474197; bh=GaDQ9JqTnH4ql7tm/PH+lPX5ScztcQCWp8V1WHR2uL4=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ZO4RrMe6kl/hDCx8MMxQ7//zvdnLJpOzDQq8vZsmjue1MW+sbMoLlIiZZiHASO1b1 dLPLYUQ0bqMjGQ7k6jzP15G2OQU6iaflTELX18eco/6C8/KBUk+dVW8K+WyzEhA1mt yvnmK1IMI13vOSXOsbQ5qoTcRY0h16v4fXV9wWr/EmiTvp0pFGDptZNEhoxjJnXpjX MnQQzC0Ab1idFQqeCChslOcleE8jbwX5sKkvxqsdjpTRifnnTfRulgNB2ddu1vCvGE Ee1zYcEO0t0X2LAdDG0yVp7YXjBN35rrQz3L6Sbln5e+ArsWxT8gFNb639OtYVKmFa PXQK6+e7SKDTg== Received: from biznet-home.integral.gnuweeb.org (unknown [68.183.184.174]) by gnuweeb.org (Postfix) with ESMTPSA id B119B249DA7; Fri, 23 Jun 2023 05:49:53 +0700 (WIB) Date: Fri, 23 Jun 2023 05:49:49 +0700 From: Ammar Faizi To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Jens Axboe , Alviro Iskandar Setiawan , Guillem Jover , Jeff Moyer , Stefan Hajnoczi , Michael William Jonathan , Matthew Patrick , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List Subject: Re: [RFC PATCH liburing v1 3/3] src/Makefile: Allow using stack protector with libc Message-ID: References: <20230622172029.726710-1-ammarfaizi2@gnuweeb.org> <20230622172029.726710-4-ammarfaizi2@gnuweeb.org> <6734a933-6e61-45b1-969c-1767f1aad43b@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6734a933-6e61-45b1-969c-1767f1aad43b@t-8ch.de> X-Bpl: hUx9VaHkTWcLO7S8CQCslj6OzqBx2hfLChRz45nPESx5VSB/xuJQVOKOB1zSXE3yc9ntP27bV1M1 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 22, 2023 at 07:57:38PM +0200, Thomas Wei?schuh wrote: > There are patches in the pipeline that enable stackprotector support for > nolibc [0]. They should land in 6.5. That's interesting. I haven't been following Willy's tree for a while. Hope 6.4 stable goes well by the end of this week. > It only supports "global" mode and not per-thread-data. > But as nolibc does not support threads anyways that should not matter. > A compiler flag has to be passed though, but that can be automated [1]. > > So the -fno-stack-protector can probably be removed completely. > > [0] https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/include/nolibc/stackprotector.h?h=dev.2023.06.16a > [1] https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/testing/selftests/nolibc/Makefile?h=dev.2023.06.16a#n81 This is a bit problematic because liburing.so and liburing.a must also be compatible with apps that use libc. Note that liburing nolibc is also used by apps that use libc. The problem when an app uses libc.so and liburing.a: Stack-protector functions from liburing nolibc will override the stack-protector functions from libc because statically linked functions will take precedence. The end result, the app will always use the "global" mode stack protector even if it's multithreaded. There may be a way to make those functions private to liburing only, but I don't know. We had a similar problem with memset() in liburing: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/liburing.git/commit/?id=db5403e58083bef48d72656d7dea53a9f7affef4 Also, the app has to be compiled with those specific flags, which is out of our control. Plus, I wonder if there is a chance to call __stack_chk_init() from a static library point of view where we don't control the entry point (__start). Therefore, I won't implement the stack protector for liburing under CONFIG_NOLIBC enabled. So far, I see that using the stack protector for liburing nolibc is more trouble than it's worth. But anyway, it's nice to see your stack protector work. Regards, -- Ammar Faizi