From patchwork Sat Apr 14 16:20:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 7814 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C6DA623E42 for ; Sat, 14 Apr 2012 16:20:50 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8FCC2A185AE for ; Sat, 14 Apr 2012 16:20:50 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so7572362iag.11 for ; Sat, 14 Apr 2012 09:20:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=nPWhbeVYkthnEko9l2nkpmLJkA9vmM4QSktW48sWYao=; b=VJnAhFasBYIzMsdeTwbr5fBwH2NHNl8JrLCZam1qg6hiBl8/UR4uNRHfw7fsQ/AyTt lO2SvlEZUpf23aoYPVsCgG3G4hkL8pjHy29ZDmc5Hw8xCcNsZjai9nHmJNRJ0KjrWaad gx51yZmurCJIbcp9aBiWYwPJIE5wvSDk8r6F3Duw/AobcVzgQYOlMO9M72az+xLIBbwH yq7xpv037HzoLS45cvI7BD5mGsQLsOhOsGaMmcEl+q7ZiFFCDjBVU+nSJoGUQiCzdaub 2PbHQaz0gyjpLUBpE5tdfSEdE1L8PqBSY0XuAcsK8Q3vDWq8uGvH6DgB6H5Rv4yWZdBz eUlQ== Received: by 10.50.149.163 with SMTP id ub3mr1488069igb.30.1334420450364; Sat, 14 Apr 2012 09:20:50 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.70.69 with SMTP id c5csp89569ibj; Sat, 14 Apr 2012 09:20:50 -0700 (PDT) Received: by 10.182.40.7 with SMTP id t7mr7527618obk.55.1334420449844; Sat, 14 Apr 2012 09:20:49 -0700 (PDT) Received: from e35.co.us.ibm.com (e35.co.us.ibm.com. [32.97.110.153]) by mx.google.com with ESMTPS id oi3si6296239obb.93.2012.04.14.09.20.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Apr 2012 09:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.153 as permitted sender) client-ip=32.97.110.153; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.153 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 14 Apr 2012 10:20:49 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 14 Apr 2012 10:20:47 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id B10243E40047; Sat, 14 Apr 2012 10:20:46 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3EGKkWI176510; Sat, 14 Apr 2012 10:20:46 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3EGKgJS025791; Sat, 14 Apr 2012 10:20:45 -0600 Received: from paulmck-ThinkPad-W500 ([9.49.223.21]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q3EGKfoG025683; Sat, 14 Apr 2012 10:20:41 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 023FFE5270; Sat, 14 Apr 2012 09:20:39 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, patches@linaro.org, torvalds@linux-foundation.org, "Paul E. McKenney" , "Paul E. McKenney" Subject: [PATCH RFC 5/7] fs: Silence bogus copy_to_user() build errors Date: Sat, 14 Apr 2012 09:20:35 -0700 Message-Id: <1334420437-19264-5-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1334420437-19264-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120414161953.GA18140@linux.vnet.ibm.com> <1334420437-19264-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12041416-6148-0000-0000-0000050AE6F6 X-Gm-Message-State: ALoCoQnE7cp4lQxC+wAaXMGjLijo/B23tKk6PKV4IC+5FpLtOEQxI5++MDcFqYBniyLVyl8VwQD0 From: "Paul E. McKenney" The copy_to_user() function now does some compile-time buffer-size checks, but these checks can be fooled by pointers, which always appear to be 4 or 8 bytes long for 32-bit and 64-bit builds, respectively. Take care of the warnings in fs/binfmt_misc.c by invoking the underlying _copy_to_user() function. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney --- fs/binfmt_misc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index a9198df..e5ea8c3 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -310,7 +310,7 @@ static Node *create_entry(const char __user *buffer, size_t count) p = buf = (char *)e + sizeof(Node); memset(e, 0, sizeof(Node)); - if (copy_from_user(buf, buffer, count)) + if (_copy_from_user(buf, buffer, count)) goto Efault; del = *p++; /* delimeter */ @@ -418,7 +418,7 @@ static int parse_command(const char __user *buffer, size_t count) return 0; if (count > 3) return -EINVAL; - if (copy_from_user(s, buffer, count)) + if (_copy_from_user(s, buffer, count)) return -EFAULT; if (s[count-1] == '\n') count--;