From patchwork Wed Jul 19 12:53:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 108284 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp780597qge; Wed, 19 Jul 2017 05:56:00 -0700 (PDT) X-Received: by 10.84.210.196 with SMTP id a62mr2945820pli.165.1500468959968; Wed, 19 Jul 2017 05:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500468959; cv=none; d=google.com; s=arc-20160816; b=f3eyVHKnlRQnLb4AmdKmatC4m+M3Fbic7NqYqTZ312G7RSCEngJZn4lEwPXtP33GvM 0G8sy4xEdP7HSm0IP3xrRBzQx89a7z1lcXmOQpvbrggzxMmbqx579FKHV2FP6y27hokH K3nD64R3U3fSKSRVTo0Ax6faZEpBN9D/IM8t1NCASNGYcqDgkL3zFUTpJ4lOV+c504ga IV24Y6xdyjvu7derlPlZ9DqEu0vecXQe1O7zbm6bjry8xKWCxFh87TkG1ZnLrM2ggA/i fYj3VBTtRCy1farQxh/IJFqtFuw56KzxvF4zkBg2YHjNNORxuIHcE65Gf7YJ2eOd8rJA yelQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=uIgtXuUh0gr8NTcT1xO0ZJ/efuVqmJqclGE1RtRSUAY=; b=l95h1FMb+EQCPdnCLmxlUgaJNuAlMpl88cjdjtWbdBT7zEne9N6bKby6SfqVwQxML/ bASKDkR6SCkm2+XcQDiZE6N+pzm6ErRH2x+chOdFvTJu7UALrP+GSOFhq0IwCle1O1LF rLVjPvdA+M26DhrNxdnjaiI2pOQupGDmoyv43XXP+ghrAu3mEOsRCSCc/EclKCm2UAYM F8TLOKLkxecPfQf8zh1PP+Rz+3fD5PGlRxNcyQ9s1VYQHxoSwun3jDa+dFN2K4kPwr2a A+IyVGopYcl1MZQljl6dhUEUNTEn3YgGDjyMSYQPMKRw3xn3p0sQcETMYDYjyQSPB9LH Cxxg== 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 z73si195343pfl.657.2017.07.19.05.55.59; Wed, 19 Jul 2017 05:55:59 -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 S1753959AbdGSMz4 (ORCPT + 25 others); Wed, 19 Jul 2017 08:55:56 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50749 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753906AbdGSMzw (ORCPT ); Wed, 19 Jul 2017 08:55:52 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0ML81x-1dXXWA3uwj-000H4v; Wed, 19 Jul 2017 14:54:48 +0200 From: Arnd Bergmann To: x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Borislav Petkov , Tom Lendacky Subject: [PATCH 4/8] x86: io: add "memory" clobber to insb/insw/insl/outsb/outsw/outsl Date: Wed, 19 Jul 2017 14:53:02 +0200 Message-Id: <20170719125310.2487451-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170719125310.2487451-1-arnd@arndb.de> References: <20170719125310.2487451-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:yEz02GrQ1NDRLU/SmQL+qhi2PiriwIo3dbrOrX7v6VfvQIlcs63 y63eoVWQkC0JmC4OgfasgfZGYJnjs5vLxlSVmdTRP+tU+LuT0i7Ej5IUk2LtGEhfIYFKzII Z9Xxrf6NQq198NDK5zg6GjJT4mBUtMx8jYXoNc3hgSTnC29G60xXz9mPCJ6W55c09jGHRNR OkiRgGQJ1fCvJ9p4aVjvQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:DCgrFFUjmT0=:1Tfc+4P+o1iEn5+aMdPJyj q9Zu5RqDIlUqieh6xRJmjNmvDKImh3ZzM46/sXoImJTmPwbdv6SopQEWt4lcOp4iO0vRbM8/B AGz10xXjYbYkPFtC4gk4xC3GbHveZjQXtWPtnQ0h2g3Zx8CoEeUvL6bmYMpZURNCXpTo8khWN JyqmRfG8+sZ9bgloOtT/4isi/druYcENFjnEMJipVrqRJKGyyXS8Ya13gQZebaYRtDP2ysGbK lhbq1NZ9d0uBFTwbt6/pqv0bcFMINoCl9iPyefggAcW6d7pO1zLiX9iSKyjTAsfsrd0m4uK4z IjPQXTmO5iG4l/VkcmDS5bNWcjTBYrO+5Yil6N5KwEtPuVeaROpKfDvBdPiqHRmOjBknsHsih F7AH79ypjTe2xUW6Y6QNJk8k+/XIai6PaNyhB7d5bQ3+MgWrLdzBYMETjsqhXQ1qn75iUM/LD +ujwN444LYoZagOVt0Sg7WoPomoFGHdpy8tx8k5YcxorcAd2Usw/oYX/apNEGFtuZksgM73Te 4PVir+YMuYuQAcIW4Rh+DaW8DZ43cm7CKI4OSzBteUtMb/7/LXstenr8FWtp7Aw7AoZ+9Kb4J zccvSAAekPP3CXFDJSmYsQRI0KkTDsgriqOyG5B80CqYLJLN9ujKHSEacYuDo/7z9vedFrsXu Npzg5GlHCDzFdlLYBBGLUB/6SgBzMugzpw8ObU9lm3XIPJ0U2Sm1h+uaQCJ/y1A867kEt4ZcD tfUBZMsAlu5tj4XSPc18pu5aO6dRKLfa58rw/nYQJZiY4ETJK+7S6nh/Q0k= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The x86 version of insb/insw/insl uses an inline assembly that does not have the target buffer listed as an output. This can confuse the compiler, leading it to think that a subsequent access of the buffer is uninitialized: drivers/net/wireless/wl3501_cs.c: In function ‘wl3501_mgmt_scan_confirm’: drivers/net/wireless/wl3501_cs.c:665:9: error: ‘sig.status’ is used uninitialized in this function [-Werror=uninitialized] drivers/net/wireless/wl3501_cs.c:668:12: error: ‘sig.cap_info’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/net/sb1000.c: In function 'sb1000_rx': drivers/net/sb1000.c:775:9: error: 'st[0]' is used uninitialized in this function [-Werror=uninitialized] drivers/net/sb1000.c:776:10: error: 'st[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/net/sb1000.c:784:11: error: 'st[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized] I tried to mark the exact input buffer as an output here, but couldn't figure it out. As suggested by Linus, marking all memory as clobbered however is good enough too. For the outs operations, I also add the memory clobber, to force the input to be written to local variables. This is probably already guaranteed by the "asm volatile", but it can't hurt to do this for symmetry. Link: https://lkml.org/lkml/2017/7/12/605 Suggested-by: Linus Torvalds Signed-off-by: Arnd Bergmann --- v2: replace broken original RFC patch with one that probably works. The crazy stack usage I reported in teh wl3501_cs driver with my original patch is gone too now. --- arch/x86/include/asm/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index e080a39b2108..4bc6f459a8b6 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -328,13 +328,13 @@ static inline unsigned type in##bwl##_p(int port) \ static inline void outs##bwl(int port, const void *addr, unsigned long count) \ { \ asm volatile("rep; outs" #bwl \ - : "+S"(addr), "+c"(count) : "d"(port)); \ + : "+S"(addr), "+c"(count) : "d"(port) : "memory"); \ } \ \ static inline void ins##bwl(int port, void *addr, unsigned long count) \ { \ asm volatile("rep; ins" #bwl \ - : "+D"(addr), "+c"(count) : "d"(port)); \ + : "+D"(addr), "+c"(count) : "d"(port) : "memory"); \ } BUILDIO(b, b, char)