Skip to content

wlroots: backport patch for free() of ununitialized#212298

Merged
wegank merged 1 commit intomasterfrom
unknown repository
Jan 26, 2023
Merged

wlroots: backport patch for free() of ununitialized#212298
wegank merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 23, 2023

Description of changes

This cherrypicks an upstream-but-unreleased commit for the following build failure. Strangely, this warning is not emittted on x86_64.

FAILED: libwlroots.so.11.p/render_egl.c.o
gcc -Ilibwlroots.so.11.p -I. -I.. -Iinclude -I../include -Iprotocol -I../protocol -Irender/gles2/shaders -Irender/vulkan/shade
../render/egl.c: In function 'egl_init_display':
../render/egl.c:179:17: error: 'external_only' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  179 |                 free(external_only);
      |                 ^~~~~~~~~~~~~~~~~~~
../render/egl.c:128:29: note: 'external_only' was declared here
  128 |                 EGLBoolean *external_only;
      |                             ^~~~~~~~~~~~~
../render/egl.c:178:17: error: 'modifiers' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  178 |                 free(modifiers);
      |                 ^~~~~~~~~~~~~~~
../render/egl.c:127:27: note: 'modifiers' was declared here
  127 |                 uint64_t *modifiers;
      |                           ^~~~~~~~~
cc1: all warnings being treated as errors
Things done
  • Built on platform(s)
    • x86_64-linux
    • powerpc64le-linux
  • Fits CONTRIBUTING.md.

This cherrypicks an upstream-but-unreleased commit for the following
build failure.  Strangely, this warning is not emittted on x86_64.

FAILED: libwlroots.so.11.p/render_egl.c.o
gcc -Ilibwlroots.so.11.p -I. -I.. -Iinclude -I../include -Iprotocol -I../protocol -Irender/gles2/shaders -Irender/vulkan/shade
../render/egl.c: In function 'egl_init_display':
../render/egl.c:179:17: error: 'external_only' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  179 |                 free(external_only);
      |                 ^~~~~~~~~~~~~~~~~~~
../render/egl.c:128:29: note: 'external_only' was declared here
  128 |                 EGLBoolean *external_only;
      |                             ^~~~~~~~~~~~~
../render/egl.c:178:17: error: 'modifiers' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  178 |                 free(modifiers);
      |                 ^~~~~~~~~~~~~~~
../render/egl.c:127:27: note: 'modifiers' was declared here
  127 |                 uint64_t *modifiers;
      |                           ^~~~~~~~~
cc1: all warnings being treated as errors
@ofborg ofborg bot added the ofborg-internal-error Ofborg encountered an error label Jan 23, 2023
@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 24, 2023

@ofborg eval

@ofborg ofborg bot requested review from Synthetica9 and primeos January 24, 2023 07:08
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 24, 2023
@NickCao NickCao removed the ofborg-internal-error Ofborg encountered an error label Jan 24, 2023
@wegank
Copy link
Copy Markdown
Member

wegank commented Jan 26, 2023

Is it a powerpc64le-linux-specific issue? Not seeing this on Hydra on aarch64-linux and x86_64-linux.

@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 26, 2023

Is it a powerpc64le-linux-specific issue? Not seeing this on Hydra on aarch64-linux and x86_64-linux.

If you take a look at the code they are very obviously using an uninitialized variable. And they admit so and fix it in the patch that is backported here.

The only mystery is why gcc doesn't produce a warning on x86_64 or aarch64. It should.

@wegank wegank merged commit 50a4314 into NixOS:master Jan 26, 2023
@ghost ghost deleted the pr/wlroots/fixbuild branch January 27, 2023 02:09
@B4dM4n
Copy link
Copy Markdown
Contributor

B4dM4n commented Jan 27, 2023

The patch does not apply for me:

$ # github:NixOS/nixpkgs is at 089fa2e1131765839c058c8cdd08b28d2e693995
$ nix build -L 'github:NixOS/nixpkgs/089fa2e1131765839c058c8cdd08b28d2e693995#wlroots_0_16'
wlroots> unpacking sources
wlroots> unpacking source archive /nix/store/kpbd31jbph0bkmax8qiga9lfi452vqa1-source
wlroots> source root is source
wlroots> patching sources
wlroots> applying patch /nix/store/rpmkvanwa0shk55rdaf0k1w1750s0fbl-ed71915742160f2b9157adbad79364e22ab7ebda.patch
wlroots> patching file render/egl.c
wlroots> Reversed (or previously applied) patch detected!  Assume -R? [n]
wlroots> Apply anyway? [n]
wlroots> Skipping patch.
wlroots> 1 out of 1 hunk ignored -- saving rejects to file render/egl.c.rej
error: builder for '/nix/store/qw7jqma6yw5kkbghl6fxa4zcfvklyxv3-wlroots-0.16.1.drv' failed with exit code 1;

@wegank
Copy link
Copy Markdown
Member

wegank commented Jan 27, 2023

@B4dM4n Sorry for the inconvenience! Reverted.

@amjoseph-nixpkgs It looks like wlroots points to wlroots_0_15, so ofborg didn't catch the error. Could you please check if the patch has already been applied?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants