Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads: fix potential unitialized members in sched_param #14342

Closed
wants to merge 1 commit into from

Conversation

theuni
Copy link
Member

@theuni theuni commented Sep 27, 2018

Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Building with gcc 8.2 against musl libc, which apparently has more attributes
available in its sched_param. The following warnings were produced:

    warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

Since the current thread may have interesting non-zero values for these fields,
we want to be sure to only change the intended one. Query and modify the
current sched_param rather than starting from a zeroed one.
@DrahtBot
Copy link
Contributor

Coverage Change (pull 14342) Reference (master)
Lines -0.0579 % 87.0361 %
Functions -0.0463 % 84.1130 %
Branches -0.0436 % 51.5451 %

@practicalswift
Copy link
Contributor

Concept ACK

Nice find!

@fanquake
Copy link
Member

Concept ACK

I assume this turned up during some 🐢 related work? I'm planning on getting setup to test that/musl going forward, so will give a proper ACK here if I get that done before this is merged.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 5, 2018

Needs rebase

@practicalswift
Copy link
Contributor

@theuni I'd like to reproduce by building against musl myself - do you remember which build parameters you used? :-)

@fanquake
Copy link
Member

Rebased in #14839.

@fanquake fanquake closed this Nov 29, 2018
laanwj added a commit that referenced this pull request Jan 16, 2019
8928237 threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's #14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2021
…ed_param

8928237 threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's bitcoin#14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2021
…ed_param

8928237 threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's bitcoin#14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…ed_param

8928237 threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's bitcoin#14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…ed_param

8928237 threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's bitcoin#14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants