public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <thomas@t-8ch.de>
Cc: "Alexey Dobriyan" <adobriyan@gmail.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector
Date: Sun, 26 Mar 2023 20:45:04 +0200	[thread overview]
Message-ID: <ZCCSsFGqTFWknGBL@1wt.eu> (raw)
In-Reply-To: <8e156377-e7d9-48ec-a7ee-292aba002201@t-8ch.de>

On Sun, Mar 26, 2023 at 01:42:35PM -0500, Thomas Weißschuh  wrote:
> 
> Mar 26, 2023 13:30:21 Alexey Dobriyan <adobriyan@gmail.com>:
> 
> > 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

  reply	other threads:[~2023-03-26 18:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 18:30 [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector Alexey Dobriyan
2023-03-26 18:42 ` Thomas Weißschuh 
2023-03-26 18:45   ` Willy Tarreau [this message]
2023-03-26 19:38     ` Alexey Dobriyan
2023-03-26 19:42       ` Willy Tarreau
2023-03-27 15:32         ` Alexey Dobriyan
2023-03-27 15:54           ` Willy Tarreau
2023-03-27 23:20             ` Thomas Weißschuh
2023-03-28  4:59               ` Willy Tarreau
  -- strict thread matches above, loose matches on Subject: below --
2023-03-25 15:45 [PATCH 0/8] tools/nolibc: add support for stack protector Willy Tarreau
2023-03-25 15:45 ` [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector Willy Tarreau

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=ZCCSsFGqTFWknGBL@1wt.eu \
    --to=w@1wt.eu \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=paulmck@kernel.org \
    --cc=thomas@t-8ch.de \
    /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