Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4697307img; Tue, 26 Mar 2019 15:01:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqykTZV+dA0+uX+XIGZNaKptj8Iru6Kcj2qMvynVnzzHDnMDGQcSlIdSCefoxuSqXHTzH0Wf X-Received: by 2002:a17:902:b481:: with SMTP id y1mr33596453plr.338.1553637690756; Tue, 26 Mar 2019 15:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553637690; cv=none; d=google.com; s=arc-20160816; b=bhmABiENnVeLEc3J/sr60bbjX2HJGHvgtZ8njktY43H7k1f9X/cMbRmQ/lJWccfn3q mHK4TKcYjXEt2VX8woABGJu4aTwVPoh51hg2XY9LDKp9EnPDi/naXELO3/dXi6DexkYV jeyPcKZvxF+NY132fNSRQ77Zl/dEcCfSQ3CF0mGIrd5wYqjP+aG3WxzqfavraOCrYZvt 04G9Z9zyDCzgW07T8b350DX+TeFdLLzJdz4A75bdrYvFftjPkPfu1EgH+gFXzHGUl53N RFoc8i24zoIfwa7YCE92iOesClsM50yjBNDl3iMLIMSEyB1TZXm780mkQIYwj+7ZD/73 F5yw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=fkpdjqViilnYU9WiVNhX7WKTsJzNqNG81IFUZBYiVuo=; b=Oya53w77sftCFJxwEWI2MkRQL/QcaOHjGVYFYwgKlFwbv1lNt/ZMD5jj0btFmHQhNf LrrXunNn0SHFuRintFG0nbyRC3gghm4UFvG2QEB8j7I8Ue3vu2Cd5iA4loeF6NB7W3/u btyd7TcMKo7aoy1kciU0TKMAnU4Z/J4FSqhHhm5s5CDfhF8zBhEjkl2Q0mgDU4o2EReE S5MdmD9KTw93wwpmbp+J+DxN+LA70BX8a285qk7EWfLezNWKy96JtBiWkWp/hzuG0KSS ubJ/D6s50hFekrYZkq5Jiq3rJ5cwo/rvg01B6ssI3XzV5AmGUKUQ0dCjJ+Ed8fFoi0t8 yokA== 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 h65si9346569pfd.232.2019.03.26.15.01.14; Tue, 26 Mar 2019 15:01:30 -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 S1731859AbfCZV7P (ORCPT + 99 others); Tue, 26 Mar 2019 17:59:15 -0400 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]:46402 "EHLO mx0a-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfCZV7P (ORCPT ); Tue, 26 Mar 2019 17:59:15 -0400 Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2QLrtvZ021168; Tue, 26 Mar 2019 21:58:48 GMT Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 2rfsy2h8kx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2019 21:58:48 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id AEB8360; Tue, 26 Mar 2019 21:58:47 +0000 (UTC) Received: from [16.214.194.75] (unknown [16.214.194.75]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 1284149; Tue, 26 Mar 2019 21:58:45 +0000 (UTC) Subject: Re: [PATCH 3/6] bitmap_parselist: rework input string parser To: Yuri Norov , Andy Shevchenko , Yury Norov Cc: Andrew Morton , Rasmus Villemoes , Arnd Bergmann , Kees Cook , Matthew Wilcox , Tetsuo Handa , "linux-kernel@vger.kernel.org" , Mike Travis , Thomas Gleixner References: <20190325210748.6571-1-ynorov@marvell.com> <20190325210748.6571-4-ynorov@marvell.com> <20190326101045.GT9224@smile.fi.intel.com> From: Mike Travis Message-ID: Date: Tue, 26 Mar 2019 14:58:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-26_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903260147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/26/2019 2:09 PM, Yuri Norov wrote: > + Mike Travis > + Thomas Gleixner > > ---------------------------------------------------------------------- > On Tue, Mar 26, 2019 at 12:07:45AM +0300, Yury Norov wrote: >>> The requirement for this rework is to keep the __bitmap_parselist() >>> copy-less and single-pass but make it more readable and maintainable by >>> splitting into logical parts and removing explicit nested cycles and >>> opaque local variables. >>> >>> __bitmap_parselist() can parse userspace inputs and therefore we cannot >>> use simple_strtoul() to parse numbers. > >> So, all above depends to what memory we access kernel / user space. >> Perhaps we can get copy of memory of a given size and then parse it in kernel space always? > >> -- >> With Best Regards, >> Andy Shevchenko > > What I missed during rework is that we have only one caller of *parselist_user? - > it's write_irq_affinity() introduced by Mike Travis in kernel/irq/proc.c. It doesn't look > like a hot path as it's file operations handler. If no objections from Mike or Thomas, No objections from me as long as you can still change irq affinity using a cpulist instead of a cpumask. Thanks, Mike Travis > I think it would make sense to copy_from_user() the userspace data at the beginning > in sake of simplicity of __bitmap_parselist(), as you suggested above. > > Yury >