[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/4] xen: arm: enable stack protector feature


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Mon, 9 Dec 2024 12:45:44 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y8bznm84kU0YtF2i42eNMqgCyDG4tsFHTXuze6cnOxY=; b=neESyKKaCguF2hzOXmLJTL1/gzA+B1BARAjDkLGp27W2D+bKuI7aCfc1lTLAoEU3EvKhT2IjLMtDrQsUUiXcVddsnkjbNZ5PT6q6gVNa81/9q8WoZoRpyp1Zbye26teyS7raKEAo0MWl1+wIDD8Ou7wifqzcuznHHEdC1amFJkP38DoHcVRDMJGrn5qwTktYEmaLC4l6f7nJO+BJmMolzjP2OQGh+tgnXtZEwtiIGCFL+1Gt+gA3cFCisSdmOt9tCtyM2/7uY1Grgm8KlLcfzTZ3SRHKgsRi0xerbTLjWZo+smpMLu36TZRvaKzoo8iQC3hbyzNw+XSOGewEyqx4TA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pVZul+hHYNiMTSt/0UGR6MxECueAQmUl6tZybv9tVBt/P+RCvENbkGl5CmGnwMKh0Y0FMM1x3G4iaqqo5tTNujNFmeNy0R6CEmdX3hwRWxRZ4gIIvY5NWdsuPNk64bMJwQc/B3vr04fwaZCNByALEHEHHlLVtsR21PVzCyR4AnJ4+WgEx7ptPm6lO6FND375eswxaja54O7CxGiDpdKkckMQktHtw4SnqQ6IohVoIgTRz8gjYLwQEmxjRudAQhHuPStfmtb38aN0Q1inRGXeMZF2E4gKVS+nUo8zgPUSz5n5ZnI4YVTxIbPJZIqksSuJSMcPSbKWJxoR4hCMRw8YNw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Julien Grall <julien.grall.oss@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Mon, 09 Dec 2024 12:45:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbQsSdZeSazgkTckCfCx9gDu8jUA==
  • Thread-topic: [PATCH v2 3/4] xen: arm: enable stack protector feature

Hi Jan,

Jan Beulich <jbeulich@xxxxxxxx> 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.