Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1826391imm; Mon, 3 Sep 2018 10:26:10 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/7ElcVRi5VgNlkVfU5lhkrZ2UhIlfSnt1TLt4YwcTYjS5/eky5QeWzVFSbZO5FeYTd/x3 X-Received: by 2002:a63:3387:: with SMTP id z129-v6mr27334623pgz.104.1535995570296; Mon, 03 Sep 2018 10:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995570; cv=none; d=google.com; s=arc-20160816; b=q7E2Xwug9ix0iVEeTjtcmbT374eBsXi5Gh9JByr3w9g5qGFBzXmty9GMSTGf4sKzXQ bElGSLGHcXnYM1c90Nzl5NtpZfmNUDzKTmF7JTEHi5oygVQC1wdwDHSIpUt/uvI/eui9 HfOSMu1AQuFgJxY+vC0gdiJwqxjOM7TaN6+tg0vJj9R/FYu8xw3SNirn5eVxxZwdYr9H MqjuS9j5Kb/ndc3lEvQRN5sCu/KBm2sfdiGyRz+I4gt+8seYKNZELb3oRKI1/fsZ6gLp zgc89mRw8hhDXY5qAgNOjJb/ra44mB+A/DHiyVm1UfcjSDnzKwcjuXl1cuyXWa9a4eVw yJCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lu8Ea5RbtRTYnJx4jF8fXrkkz74GyFL4K3jnFFlgPkc=; b=0hlO9WIs9og2nJAHmAMEKM7QoEtyIxDrsV5jnUjJeDTTVbOLrDcg4IjpT2ZXFEERwt HZrbrVhCmciC1qBuFvOOzfVGxnYvmxBx3gF5hQfaPrNRnzDTA5mxHMDj8tAtHYDUNvLZ +HDr1YaVncIpNbK7d4NdUFyVjCU+ldU+8tljVPfh760oB2DKImv93LhxdtF4jw98SwVy dgQcUsHyLyvcvOj+Qk+i6oTNaXPw1FMCnRx2FDs0oSCVIIc5lWTo7Sp9SBV2ZrFLTYFh qjxH858Ro7ME96d7ehRAr5V+yuVHguP3pKr0bCBW5v3haPAByZAGDzAHvHI4pYTnrz1P 8Arw== 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 k185-v6si18428307pgd.523.2018.09.03.10.25.55; Mon, 03 Sep 2018 10:26:10 -0700 (PDT) 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 S1730344AbeICVpV (ORCPT + 99 others); Mon, 3 Sep 2018 17:45:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45480 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729531AbeICVpU (ORCPT ); Mon, 3 Sep 2018 17:45:20 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EA97DD0A; Mon, 3 Sep 2018 17:24:13 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davidlohr Bueso , Manfred Spraul , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 056/165] ipc/sem.c: prevent queue.status tearing in semop Date: Mon, 3 Sep 2018 18:55:42 +0200 Message-Id: <20180903165657.941791272@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Davidlohr Bueso [ Upstream commit f075faa300acc4f6301e348acde0a4580ed5f77c ] In order for load/store tearing prevention to work, _all_ accesses to the variable in question need to be done around READ and WRITE_ONCE() macros. Ensure everyone does so for q->status variable for semtimedop(). Link: http://lkml.kernel.org/r/20180717052654.676-1-dave@stgolabs.net Signed-off-by: Davidlohr Bueso Cc: Manfred Spraul Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- ipc/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/ipc/sem.c +++ b/ipc/sem.c @@ -2041,7 +2041,7 @@ static long do_semtimedop(int semid, str } do { - queue.status = -EINTR; + WRITE_ONCE(queue.status, -EINTR); queue.sleeper = current; __set_current_state(TASK_INTERRUPTIBLE);