All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall.oss@gmail.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v2 3/4] xen: arm: enable stack protector feature
Date: Mon, 9 Dec 2024 12:45:44 +0000	[thread overview]
Message-ID: <87v7vt2few.fsf@epam.com> (raw)
In-Reply-To: <0de3796a-b2b4-4661-b6d7-eee32be66014@suse.com> (Jan Beulich's message of "Mon, 9 Dec 2024 10:36:00 +0100")


Hi Jan,

Jan Beulich <jbeulich@suse.com> writes:

[...]


>
>> #else
>>     const unsigned long a = 2862933555777941757;
>> #endif
>>     const unsigned c = 1;
>
> I'm having a hard time seeing why this need to be a static variable. Its
> sole use is ...

It's a constant in a hope that compiler is smart enough to optimize it out.

>>     unsigned long cycles = get_cycles();
>> 
>>     if ( !cycles )
>>         return;
>> 
>>     __stack_chk_guard = cycles * a + c;
>
> ... here, where you can as well write a literal 1.

For readability. Formula for LCG is X_n+1 = (X_n * a + c) mod m.

-- 
WBR, Volodymyr

      reply	other threads:[~2024-12-09 12:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30  1:10 [PATCH v2 0/4] Add stack protector Volodymyr Babchuk
2024-11-30  1:10 ` [PATCH v2 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS Volodymyr Babchuk
2024-12-02  8:06   ` Jan Beulich
2024-12-02 10:32     ` Andrew Cooper
2024-12-02 11:31     ` Jan Beulich
2024-11-30  1:10 ` [PATCH v2 2/4] xen: common: add ability to enable stack protector Volodymyr Babchuk
2024-12-02  8:29   ` Jan Beulich
2024-12-03 20:33   ` Andrew Cooper
2024-12-05  3:34     ` Volodymyr Babchuk
2024-12-05 12:52       ` Andrew Cooper
2024-11-30  1:10 ` [PATCH v2 4/4] xen: riscv: enable stack protector feature Volodymyr Babchuk
2024-12-02  8:12   ` Jan Beulich
2024-12-02  8:54     ` oleksii.kurochko
2024-12-02  9:56     ` oleksii.kurochko
2024-12-03 19:30       ` Volodymyr Babchuk
2024-11-30  1:10 ` [PATCH v2 3/4] xen: arm: " Volodymyr Babchuk
2024-11-30 17:06   ` Julien Grall
2024-12-03 22:00   ` Andrew Cooper
2024-12-03 23:16     ` Julien Grall
2024-12-05 19:23       ` Andrew Cooper
2024-12-06  4:46         ` Volodymyr Babchuk
2024-12-09  9:36           ` Jan Beulich
2024-12-09 12:45             ` Volodymyr Babchuk [this message]

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=87v7vt2few.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall.oss@gmail.com \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.