Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1937406rwl; Sun, 26 Mar 2023 12:08:07 -0700 (PDT) X-Google-Smtp-Source: AKy350Zp/K3LUN9GLK+GZ3y4xYg9yKM32LZXJ4U+t8AlZOlNxsBSbgHUI9m/lqhKjsSJDoA77JBm X-Received: by 2002:a17:90a:1a17:b0:23b:45be:a15a with SMTP id 23-20020a17090a1a1700b0023b45bea15amr9760269pjk.25.1679857687132; Sun, 26 Mar 2023 12:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679857687; cv=none; d=google.com; s=arc-20160816; b=hcHhT5Pi869oB2Aoxmz0Wyvo5gI3NdLWXLy4jQ7OkLlBsGDVNny800xDHdA/RapNeA 9lO89UJDFEHcme8vISia/paT+VlIzI/2ITLcjoTxVH2hTe51nwl0M1fsqrh5svNdVGpt jfd3gTFAKONAyEUHi5wLNODid6Dt/xs+1+cdUKoTAYHHlUZm703LO1HurG9OxDdsAYvY AY8BAZT3JHVltXThQUVaOxEbnTvO3yvdA3vjjrXuo9xX/YKeZZP1Vvw5wJpB73PFS9Bp h7CqAurORRphqnf0K2r82b7amJmQqTDicMO+v5OCz9dwr8kJQHTUOZEuOaRpp+WZSF+l szyA== 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; bh=A8qxW8yfsAoXv98Pslbluo0DOqTa8JQPLyYeYDefd8c=; b=xETmQyUZI4/ueYXYurQiiuNKd6Wx60pSwOxW0kmjvlyVcKpUPNFbTBrcvyXDBW6qZN sBhswCPXB8mY/d4ISsqnd04GSs5RT5O8Si2OQXldewdZnaeHnab+dqFsvoyQE4A8q5jt iMWmTy6T1zSmQEpwrUF5d0+bcxQRec6uYd7GjkGijJr7cdFmKCzH6Rs8Dvk4nVVy+MPb tHpTCtrjyGze4ZRud8AzE89foKpnTzREK/NKgdfEUvhbjdyXHV8YNm2rfQEScl3cyGDb Ml3MkS+UKgMisHtx3i8yEjKHCR7FdvlBkndRrACrOsw6pIpd+iuapL+Tx3kaWshQF5b2 w8lA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne21-20020a17090b375500b0023b35a46595si4581783pjb.99.2023.03.26.12.07.45; Sun, 26 Mar 2023 12:08:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbjCZSpP (ORCPT + 99 others); Sun, 26 Mar 2023 14:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjCZSpN (ORCPT ); Sun, 26 Mar 2023 14:45:13 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0F36D186 for ; Sun, 26 Mar 2023 11:45:11 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 32QIj4MQ011555; Sun, 26 Mar 2023 20:45:04 +0200 Date: Sun, 26 Mar 2023 20:45:04 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Alexey Dobriyan , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , "Paul E. McKenney" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector Message-ID: References: <89a960c7-0c9b-43ab-9fc8-a68405f7ed6a@p183> <8e156377-e7d9-48ec-a7ee-292aba002201@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: <8e156377-e7d9-48ec-a7ee-292aba002201@t-8ch.de> X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 Sun, Mar 26, 2023 at 01:42:35PM -0500, Thomas Wei?schuh wrote: > > Mar 26, 2023 13:30:21 Alexey Dobriyan : > > > Willy Tarreau wrote: > >> #if defined(__clang__) > >> __attribute__((optnone)) > >> #elif defined(__GNUC__) > >> __attribute__((optimize("O0"))) > >> #endif > >> static int smash_stack(void) > >> { > >> ??? char buf[100]; > >> > >> ??? for (size_t i = 0; i < 200; i++) > >> ??????? buf[i] = 'P'; > >> > >> ??? return 1; > >> } > > > > If you want to corrupt the stack, corrupt the stack! > > I do! > > > asm( > > ".globl f\n" > > "f:\n" > > "movq $0, (%rsp)\n" > > "ret\n" > > ".type f,@function\n" > > ".size f,.-f" > > ); > > > No problems with optimisation levels. > > Wouldn't this be architecture-specific? Yes it would. I'm not seeing any issue with your approach instead, let's keep it as-is for now (also it does what the stack protector is supposed to catch anyway). Willy