From: Dave Jones <davej@codemonkey.org.uk>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: problematic rc9 futex changes.
Date: Tue, 23 Jan 2018 00:34:46 -0500 [thread overview]
Message-ID: <20180123053446.GA19421@codemonkey.org.uk> (raw)
c1e2f0eaf015fb: "futex: Avoid violating the 10th rule of futex" seems to
make up a few new rules to violate.
Coverity picked up these two problems in the same code:
First it or's a value with stack garbage.
_______________________________________________________________________________________________________
*** CID 1427826: Uninitialized variables (UNINIT)
/kernel/futex.c: 2316 in fixup_pi_state_owner()
2310
2311 raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
2312
2313 oldowner = pi_state->owner;
2314 /* Owner died? */
2315 if (!pi_state->owner)
>>> CID 1427826: Uninitialized variables (UNINIT)
>>> Using uninitialized value "newtid".
2316 newtid |= FUTEX_OWNER_DIED;
2317
2318 /*
2319 * We are here because either:
2320 *
2321 * - we stole the lock and pi_state->owner needs updating to reflect
Then it notices that value is never read from before it's written
anyway.
*** CID 1427824: Code maintainability issues (UNUSED_VALUE)
/kernel/futex.c: 2316 in fixup_pi_state_owner()
2310
2311 raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
2312
2313 oldowner = pi_state->owner;
2314 /* Owner died? */
2315 if (!pi_state->owner)
>>> CID 1427824: Code maintainability issues (UNUSED_VALUE)
>>> Assigning value from "newtid | 0x40000000U" to "newtid" here, but that stored value is overwritten before it can be used.
2316 newtid |= FUTEX_OWNER_DIED;
2317
2318 /*
2319 * We are here because either:
2320 *
2321 * - we stole the lock and pi_state->owner needs updating to reflect
(The next reference of newtid being..
2369 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS;
Dave
next reply other threads:[~2018-01-23 5:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 5:34 Dave Jones [this message]
2018-01-23 8:33 ` problematic rc9 futex changes Peter Zijlstra
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=20180123053446.GA19421@codemonkey.org.uk \
--to=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox