From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751257AbeAWFey (ORCPT ); Tue, 23 Jan 2018 00:34:54 -0500 Received: from scorn.kernelslacker.org ([45.56.101.199]:56308 "EHLO scorn.kernelslacker.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbeAWFew (ORCPT ); Tue, 23 Jan 2018 00:34:52 -0500 Date: Tue, 23 Jan 2018 00:34:46 -0500 From: Dave Jones To: Peter Zijlstra Cc: Linux Kernel Subject: problematic rc9 futex changes. Message-ID: <20180123053446.GA19421@codemonkey.org.uk> Mail-Followup-To: Dave Jones , Peter Zijlstra , Linux Kernel MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Note: SpamAssassin invocation failed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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