Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7284307imu; Wed, 14 Nov 2018 14:52:26 -0800 (PST) X-Google-Smtp-Source: AJdET5e+H1t3VnQiexwCrIKMjTQZJH1aEl7d8k8zYDCoMQYVONw+gZrViZoR5+YPqK8PXh2yAxCo X-Received: by 2002:a62:5504:: with SMTP id j4-v6mr3877243pfb.166.1542235946926; Wed, 14 Nov 2018 14:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542235946; cv=none; d=google.com; s=arc-20160816; b=Q6PIMPrYgOMD0XwmPIlXMH4Wpc6xEW8672JDg/GT+U4MDX6oxTsF9+bCROLhtYSqbH I8HgvO3yHCrS9ByfcTyEdqLgPjGRDMPE3kDFbrPz1EGYiT7NQPAH0RaIRAn1cdo9U4b1 3cyj3IA5oEuYZoFqSLg5jsJ0c17UW9vegEhDyP6xhCyj4FiorhhdYw9QY5R5Y7pHTjsv rMV1+1xRD3jh1CwPsnUmhkKTPerDiL2TOoR9f7ofwbGWykuD8WDb7mEd5I0pYE3V2zuB 8p4qFwvzNs+zBwTMonMjL9l0ARc0+JFYmdQiPibLicTU/BgaHHlM3h0kF/h82SdweLNc bn7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=j6I3/OKLpdcgfUv3FZujrd6ExYOYUnfCgzQRd684uJs=; b=fgRVnD4zUQoP4XS1TTAFYNSYX+sPWaieZz8FK9iuCSG1Q4XYNOJxOwfKZixE5rrRGl q9Wk3WVIOhs2s3nOOK1GQOiZz+SR+RBSNue7qSmdU7dr9SI6lq+n+i74QV4tFUozB46D Ih+FHNCGKC5o/arcFEixTW66FcDinnEQR6vEjYODnmYF52x+tqD3NM1sq072oD9BB17I w7E5rp68ALVgbQ724qEIgJrFjper7EeJ8TdWJD8of0h1vE31cXJQ1UUtwxkkz3Fea2Py nGvlnge9D1SHqlT2rceyVlqvKUALQtOABxfG07UwhG+u+lijBc0MBtU/ZSCeEVxFKi8R 28tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=XWfsunv2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x186-v6si27597775pfx.94.2018.11.14.14.52.12; Wed, 14 Nov 2018 14:52:26 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=XWfsunv2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbeKOIz2 (ORCPT + 99 others); Thu, 15 Nov 2018 03:55:28 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:34336 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbeKOIz2 (ORCPT ); Thu, 15 Nov 2018 03:55:28 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAEMieTl052968; Wed, 14 Nov 2018 22:50:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2018-07-02; bh=j6I3/OKLpdcgfUv3FZujrd6ExYOYUnfCgzQRd684uJs=; b=XWfsunv2GZYtzIX5WV3bb/FT3wzeDf3+MaLhjJssLnjwKVLVKG/wEy2RGqNies6wwmEP Y5QPiNfQMBTkgmL5YpulcJcirflsQbGEZrfiGlDNDJY8NK3EKPPCfF3ChHbQDYL0nljA yUXlEf43Z7jIuIVoiUKrl3m0ErAsIxnJY2v09SOmih+G9qZu/OPKw74RZoKaGNBPRahM zQkMx41814wo62hGyvekm6X1Id5RM/zObR+2hk+ET9V/exGJtdR6ifh/3r0yIUSNZFyV NJY6yMH2xllWiCaj3S8AnAgMSJbDqBU7CKjtlFw03cAhhfHviyKhY/Jx002Yo3CH0nT4 ew== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2nr7cs6e0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Nov 2018 22:50:08 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAEMo7oH025936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Nov 2018 22:50:07 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAEMo6uP016990; Wed, 14 Nov 2018 22:50:06 GMT Received: from [192.168.0.102] (/73.243.10.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Nov 2018 14:50:06 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: [PATCH] mm/usercopy: Use memory range to be accessed for wraparound check From: William Kucharski In-Reply-To: <50baa4900e55b523f18eea2759f8efae@codeaurora.org> Date: Wed, 14 Nov 2018 15:50:05 -0700 Cc: David Laight , Kees Cook , crecklin@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, psodagud@codeaurora.org, tsoni@codeaurora.org, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <816A9750-D2A3-4BC8-88A6-41BFAA6A1540@oracle.com> References: <1542156686-12253-1-git-send-email-isaacm@codeaurora.org> <5dcd06a0f84a4824bb9bab2b437e190d@AcuMS.aculab.com> <7C54170F-DE66-47E0-9C0D-7D1A97DCD339@oracle.com> <50baa4900e55b523f18eea2759f8efae@codeaurora.org> To: "Isaac J. Manjarres" X-Mailer: Apple Mail (2.3445.101.1) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9077 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811140201 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 14, 2018, at 10:32 AM, isaacm@codeaurora.org wrote: >=20 > Thank you and David for your feedback. The check_bogus_address() = routine is only invoked from one place in the kernel, which is = __check_object_size(). Before invoking check_bogus_address, = __check_object_size ensures that n is non-zero, so it is not possible to = call this routine with n being 0. Therefore, we shouldn't run into the = scenario you described. Also, in the case where we are copying a page's = contents into a kernel space buffer and will not have that buffer = interacting with userspace at all, this change to that check should = still be valid, correct? Having fixed more than one bug resulting from a "only called in one = place" routine later being called elsewhere, I am wary, but ultimately it's likely not worth the performance hit of a = check or BUG_ON(). It's a generic math check for overflow, so it should work with any = address. Reviewed-by: William Kucharski =