Received: by 10.223.176.46 with SMTP id f43csp3757231wra; Mon, 22 Jan 2018 21:35:45 -0800 (PST) X-Google-Smtp-Source: AH8x227wxwG2rDAxPh6KNx14/LWvwuOWRZ241I7k8gABkXXdDKJkWo6tyviw4hCHMebq1vjMQ6aE X-Received: by 10.36.73.138 with SMTP id e10mr2265471itd.14.1516685745366; Mon, 22 Jan 2018 21:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516685745; cv=none; d=google.com; s=arc-20160816; b=XNb8dXD6CFY+JmhaOeMqMsPh3yQhmJlhIOU0qz47M7WSytsOLI1K5XtaBzsAsh0zzA lJVZ8aLaD5cQEihsaiK6+a+KkLt6qCP7yFQ7ZL6SkPzTE/1//C9S2JD6RCXLboqlfIMZ 1M+ERRQjQJcRKhuLaokawyofgQv84fYXE4JKaLQzphA1tFpChAeGvtRY088x9uBKpgmp a/IYAJ+gwx7U3jC8Qi33cWFjb2hmH1qKeEmjioifHRWFIIgd6rjl3ThyKDdGu5n1co0u SQojuKHGVe9GHM+mxLrcJa1CZ4Tula2SVyNXKBu1Xdrpx9CyLAgWsrYpaUSNp1wxnBsk 0BBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:mail-followup-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=bfBx0igFb/px8QOdn+0HySas1u9YzEQqz0YK66ZHxv0=; b=Kfx9ENAD0dTh1q2aIBwejHUi1yGox29IMd5m9udH+lOCDvhci2EGp5triqUM+4smRO s+9Cl7e5RST2KpZli8zqfhOLeZy//D0HgcFHcwkF4EjqCX7Xu0P7jwV4QqmZsAZ+EIyM LR+Zqj9jYlS/9m7A9qGLLorbddQr7r5CBTjLKmsAMCoxDLmxTm0npo+IxEE+aZWvEqEy rLooAxfNtHrAA9eXPYJlH+opEjaYZ1RAv19ye9xV+kDnk0Iut0tJwFJHp6VyG66PTlZ0 yl3PPVehXGMZEJIAxkADFrxZU6oW0ruB3Q2PrxE/3d9xxf0lw7SJbWBwThLK5W06hYcn Nx4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d142si7858341itc.36.2018.01.22.21.35.22; Mon, 22 Jan 2018 21:35:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751232AbeAWFey (ORCPT + 99 others); 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 Received: from [2601:196:4600:5b90:ae9e:17ff:feb7:72ca] (helo=wopr.kernelslacker.org) by scorn.kernelslacker.org with esmtp (Exim 4.89) (envelope-from ) id 1edrEM-0000rA-Jp; Tue, 23 Jan 2018 00:34:46 -0500 Received: by wopr.kernelslacker.org (Postfix, from userid 1000) id 20F1DBA; Tue, 23 Jan 2018 00:34:46 -0500 (EST) 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 Precedence: bulk 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