mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: "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 21:30:18 +0300	[thread overview]
Message-ID: <89a960c7-0c9b-43ab-9fc8-a68405f7ed6a@p183> (raw)

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!

asm(
".globl f\n"
"f:\n"
"movq $0, (%rsp)\n"
"ret\n"
".type f,@function\n"
".size f,.-f"
);

No problems with optimisation levels.

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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 18:30 Alexey Dobriyan [this message]
2023-03-26 18:42 ` Thomas Weißschuh 
2023-03-26 18:45   ` Willy Tarreau
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=89a960c7-0c9b-43ab-9fc8-a68405f7ed6a@p183 \
    --to=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=paulmck@kernel.org \
    --cc=w@1wt.eu \
    /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

all inboxes | Powered by JetHome®