public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [edk2-libc Patch 0/1] edk2-libc/StdLib fix uninitialized global variable
@ 2023-07-21 15:26 Jayaprakash, N
  2023-07-21 15:26 ` [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized " Jayaprakash, N
  0 siblings, 1 reply; 5+ messages in thread
From: Jayaprakash, N @ 2023-07-21 15:26 UTC (permalink / raw)
  To: devel; +Cc: Jayaprakash N

This patch has fix for un-initialized global variable in the edk2-libc repos
StdLib/BsdSocketLib.

Jayaprakash N (1):
  edk2-libc/StdLib: Uninitialized global variable

 StdLib/BsdSocketLib/res_init.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107125): https://edk2.groups.io/g/devel/message/107125
Mute This Topic: https://groups.io/mt/100278657/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable
  2023-07-21 15:26 [edk2-devel] [edk2-libc Patch 0/1] edk2-libc/StdLib fix uninitialized global variable Jayaprakash, N
@ 2023-07-21 15:26 ` Jayaprakash, N
  2023-07-21 15:33   ` Michael D Kinney
  0 siblings, 1 reply; 5+ messages in thread
From: Jayaprakash, N @ 2023-07-21 15:26 UTC (permalink / raw)
  To: devel; +Cc: Jayaprakash N, Rebecca Cran, Michael D Kinney, Kloper, Dimitry

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506

res_init() is called from different places in sockets library. It depends
on global _res variable containing a state. The problem is that
if __BIND_RES_TEXT macro is not defined, _res is not initialized.
Depending on compiler and build optimization this can fill the
variable with garbage that is later used by res_init().
Fix is trivial - explicitly initialize _res.

Cc: Rebecca Cran <rebecca@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Co-authored-by: Kloper, Dimitry <dimitry.kloper@intel.com>
Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
---
 StdLib/BsdSocketLib/res_init.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/StdLib/BsdSocketLib/res_init.c b/StdLib/BsdSocketLib/res_init.c
index 613a76a..fbc53c5 100644
--- a/StdLib/BsdSocketLib/res_init.c
+++ b/StdLib/BsdSocketLib/res_init.c
@@ -121,11 +121,11 @@ static u_int32_t net_mask __P((struct in_addr));
  */
 
 struct __res_state _res
-# if defined(__BIND_RES_TEXT)
-    = { RES_TIMEOUT, }  /* Motorola, et al. */
-# endif
-    ;
-
+#if defined(__BIND_RES_TEXT)
+    = { RES_TIMEOUT, };  /* Motorola, et al. */
+#else
+    = {0};
+#endif
 
 /*
  * Set up default settings.  If the configuration file exist, the values
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107126): https://edk2.groups.io/g/devel/message/107126
Mute This Topic: https://groups.io/mt/100278658/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable
  2023-07-21 15:26 ` [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized " Jayaprakash, N
@ 2023-07-21 15:33   ` Michael D Kinney
  2023-07-21 15:52     ` Jayaprakash, N
       [not found]     ` <1773ECE2212EEB11.21241@groups.io>
  0 siblings, 2 replies; 5+ messages in thread
From: Michael D Kinney @ 2023-07-21 15:33 UTC (permalink / raw)
  To: Jayaprakash, N, devel@edk2.groups.io
  Cc: Rebecca Cran, Kloper, Dimitry, Kloper, Dimitry, Kinney, Michael D

Hi JP,

I have not seen co-authored-by tag used before.

If Dimitry is the author, then please update git commit so
Dimitry is the author and remove that tag.

Also, please make sure that names do not contain ','.

Should be: Dimity Kloper <dimitry.kloper@intel.com>

Thanks,

Mike

> -----Original Message-----
> From: Jayaprakash, N <n.jayaprakash@intel.com>
> Sent: Friday, July 21, 2023 8:27 AM
> To: devel@edk2.groups.io
> Cc: Jayaprakash, N <n.jayaprakash@intel.com>; Rebecca Cran
> <rebecca@nuviainc.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> Kloper; Kloper, Dimitry <dimitry.kloper@intel.com>
> Subject: [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global
> variable
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506
> 
> res_init() is called from different places in sockets library. It
> depends
> on global _res variable containing a state. The problem is that
> if __BIND_RES_TEXT macro is not defined, _res is not initialized.
> Depending on compiler and build optimization this can fill the
> variable with garbage that is later used by res_init().
> Fix is trivial - explicitly initialize _res.
> 
> Cc: Rebecca Cran <rebecca@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Co-authored-by: Kloper, Dimitry <dimitry.kloper@intel.com>
> Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
> ---
>  StdLib/BsdSocketLib/res_init.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/StdLib/BsdSocketLib/res_init.c
> b/StdLib/BsdSocketLib/res_init.c
> index 613a76a..fbc53c5 100644
> --- a/StdLib/BsdSocketLib/res_init.c
> +++ b/StdLib/BsdSocketLib/res_init.c
> @@ -121,11 +121,11 @@ static u_int32_t net_mask __P((struct in_addr));
>   */
> 
>  struct __res_state _res
> -# if defined(__BIND_RES_TEXT)
> -    = { RES_TIMEOUT, }  /* Motorola, et al. */
> -# endif
> -    ;
> -
> +#if defined(__BIND_RES_TEXT)
> +    = { RES_TIMEOUT, };  /* Motorola, et al. */
> +#else
> +    = {0};
> +#endif
> 
>  /*
>   * Set up default settings.  If the configuration file exist, the
> values
> --
> 2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107127): https://edk2.groups.io/g/devel/message/107127
Mute This Topic: https://groups.io/mt/100278658/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable
  2023-07-21 15:33   ` Michael D Kinney
@ 2023-07-21 15:52     ` Jayaprakash, N
       [not found]     ` <1773ECE2212EEB11.21241@groups.io>
  1 sibling, 0 replies; 5+ messages in thread
From: Jayaprakash, N @ 2023-07-21 15:52 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Rebecca Cran, Kloper, Dimitry, Kloper, Dimitry

Hi Mike,

I was trying to explore with Co-authored-by tag as I simplified the patch with minor edits.
If it doesn't work I shall remove it.

I noticed after sending the patch. So I have sent V2 patch by removing the , in the names. 

I will go ahead and merge this change.

Regards,
JP
-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com> 
Sent: Friday, July 21, 2023 9:03 PM
To: Jayaprakash, N <n.jayaprakash@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>; Kloper, Dimitry <dimitry.kloper@intel.com>; Kloper, Dimitry <dimitry.kloper@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable

Hi JP,

I have not seen co-authored-by tag used before.

If Dimitry is the author, then please update git commit so Dimitry is the author and remove that tag.

Also, please make sure that names do not contain ','.

Should be: Dimity Kloper <dimitry.kloper@intel.com>

Thanks,

Mike

> -----Original Message-----
> From: Jayaprakash, N <n.jayaprakash@intel.com>
> Sent: Friday, July 21, 2023 8:27 AM
> To: devel@edk2.groups.io
> Cc: Jayaprakash, N <n.jayaprakash@intel.com>; Rebecca Cran 
> <rebecca@nuviainc.com>; Kinney, Michael D 
> <michael.d.kinney@intel.com>; Kloper; Kloper, Dimitry 
> <dimitry.kloper@intel.com>
> Subject: [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global 
> variable
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506
> 
> res_init() is called from different places in sockets library. It 
> depends on global _res variable containing a state. The problem is 
> that if __BIND_RES_TEXT macro is not defined, _res is not initialized.
> Depending on compiler and build optimization this can fill the 
> variable with garbage that is later used by res_init().
> Fix is trivial - explicitly initialize _res.
> 
> Cc: Rebecca Cran <rebecca@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Co-authored-by: Kloper, Dimitry <dimitry.kloper@intel.com>
> Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
> ---
>  StdLib/BsdSocketLib/res_init.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/StdLib/BsdSocketLib/res_init.c 
> b/StdLib/BsdSocketLib/res_init.c index 613a76a..fbc53c5 100644
> --- a/StdLib/BsdSocketLib/res_init.c
> +++ b/StdLib/BsdSocketLib/res_init.c
> @@ -121,11 +121,11 @@ static u_int32_t net_mask __P((struct in_addr));
>   */
> 
>  struct __res_state _res
> -# if defined(__BIND_RES_TEXT)
> -    = { RES_TIMEOUT, }  /* Motorola, et al. */
> -# endif
> -    ;
> -
> +#if defined(__BIND_RES_TEXT)
> +    = { RES_TIMEOUT, };  /* Motorola, et al. */ #else
> +    = {0};
> +#endif
> 
>  /*
>   * Set up default settings.  If the configuration file exist, the 
> values
> --
> 2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107131): https://edk2.groups.io/g/devel/message/107131
Mute This Topic: https://groups.io/mt/100278658/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable
       [not found]     ` <1773ECE2212EEB11.21241@groups.io>
@ 2023-07-21 16:22       ` Jayaprakash, N
  0 siblings, 0 replies; 5+ messages in thread
From: Jayaprakash, N @ 2023-07-21 16:22 UTC (permalink / raw)
  To: devel@edk2.groups.io, Jayaprakash, N, Kinney, Michael D
  Cc: Rebecca Cran, Kloper, Dimitry


Reviewed by : Jayaprakash N <n.jayaprakash@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jayaprakash, N
Sent: Friday, July 21, 2023 9:22 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>; Kloper, Dimitry <dimitry.kloper@intel.com>; Kloper, Dimitry <dimitry.kloper@intel.com>
Subject: Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable

Hi Mike,

I was trying to explore with Co-authored-by tag as I simplified the patch with minor edits.
If it doesn't work I shall remove it.

I noticed after sending the patch. So I have sent V2 patch by removing the , in the names. 

I will go ahead and merge this change.

Regards,
JP
-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com>
Sent: Friday, July 21, 2023 9:03 PM
To: Jayaprakash, N <n.jayaprakash@intel.com>; devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>; Kloper, Dimitry <dimitry.kloper@intel.com>; Kloper, Dimitry <dimitry.kloper@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global variable

Hi JP,

I have not seen co-authored-by tag used before.

If Dimitry is the author, then please update git commit so Dimitry is the author and remove that tag.

Also, please make sure that names do not contain ','.

Should be: Dimity Kloper <dimitry.kloper@intel.com>

Thanks,

Mike

> -----Original Message-----
> From: Jayaprakash, N <n.jayaprakash@intel.com>
> Sent: Friday, July 21, 2023 8:27 AM
> To: devel@edk2.groups.io
> Cc: Jayaprakash, N <n.jayaprakash@intel.com>; Rebecca Cran 
> <rebecca@nuviainc.com>; Kinney, Michael D 
> <michael.d.kinney@intel.com>; Kloper; Kloper, Dimitry 
> <dimitry.kloper@intel.com>
> Subject: [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized global 
> variable
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506
> 
> res_init() is called from different places in sockets library. It 
> depends on global _res variable containing a state. The problem is 
> that if __BIND_RES_TEXT macro is not defined, _res is not initialized.
> Depending on compiler and build optimization this can fill the 
> variable with garbage that is later used by res_init().
> Fix is trivial - explicitly initialize _res.
> 
> Cc: Rebecca Cran <rebecca@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Co-authored-by: Kloper, Dimitry <dimitry.kloper@intel.com>
> Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
> ---
>  StdLib/BsdSocketLib/res_init.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/StdLib/BsdSocketLib/res_init.c 
> b/StdLib/BsdSocketLib/res_init.c index 613a76a..fbc53c5 100644
> --- a/StdLib/BsdSocketLib/res_init.c
> +++ b/StdLib/BsdSocketLib/res_init.c
> @@ -121,11 +121,11 @@ static u_int32_t net_mask __P((struct in_addr));
>   */
> 
>  struct __res_state _res
> -# if defined(__BIND_RES_TEXT)
> -    = { RES_TIMEOUT, }  /* Motorola, et al. */
> -# endif
> -    ;
> -
> +#if defined(__BIND_RES_TEXT)
> +    = { RES_TIMEOUT, };  /* Motorola, et al. */ #else
> +    = {0};
> +#endif
> 
>  /*
>   * Set up default settings.  If the configuration file exist, the 
> values
> --
> 2.40.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107132): https://edk2.groups.io/g/devel/message/107132
Mute This Topic: https://groups.io/mt/100278658/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-21 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21 15:26 [edk2-devel] [edk2-libc Patch 0/1] edk2-libc/StdLib fix uninitialized global variable Jayaprakash, N
2023-07-21 15:26 ` [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Uninitialized " Jayaprakash, N
2023-07-21 15:33   ` Michael D Kinney
2023-07-21 15:52     ` Jayaprakash, N
     [not found]     ` <1773ECE2212EEB11.21241@groups.io>
2023-07-21 16:22       ` Jayaprakash, N

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox