Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp957084ybl; Thu, 23 Jan 2020 10:49:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzvibCxJQYdZeYn9QtcY0SPMvvHfFxR/taZKUM50cTkzwON3TkknTmUEAIauakdFhAnzYG/ X-Received: by 2002:aca:cdd6:: with SMTP id d205mr11282824oig.90.1579805371179; Thu, 23 Jan 2020 10:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579805371; cv=none; d=google.com; s=arc-20160816; b=yipTNwtNYUEPfkE3tb1LLTdLcKSERLRoLUEObUrfsLMsR6gMYCLd1Pw5I8VgBKeMBb JeOTnRdEAjgH7w7fp5Wwkw4olQtWZt06Pk8g4KW97Ny/A3zl1UO0yuwWMZsR+ZTXREmQ eT7w9ZKS6aKzNHGDz5I0agO4rB+mhXj1+mio2Hh+Td3ic+eVdrEWJ+TjcPgPzoRKM/0l tf25l1CP1bhY/3S1QTWb2SbYY05ncEdqidQbhjTEo4fSZ3sFlQTRSF8a2iytiL4qe4l8 D06DbcI+xl+7ILZ+Oq9oPGzfz/XITSqtHZiVvIja27W36wWcpLPgPNE7jGZez+j5TVhm MV8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nTTlf7PIq8m+h1b8hl1eM7lP8o081tv0+h5Byplabe4=; b=WrfTD9jXqBpwOxo3ryAIUTD4sP3Jss27l0LfYOjzWQqjksEqpX+t0xcctM3zODGxIN 0y7Ba+h45RXBcwfoufOSo5h7VLoJFQZbjHIPiWU7jBSyMQ9N+hi7cuuuVBeA7HIfWS76 4mVkrVP34i+n1e/Tc/803YNLt5NgOOgi+fPN0sF2NKS9UEZZf5C4HNP3FGwpvCYHVPqZ LBbkjvIrF4H9M9oUxgTV6o7g2prYp+64OpFAcu0t39l5522ibXn45igc6sDeILm4OBu6 9dLAG6+oFRXTTKov1hpAHEVbCw2SboRM2I0eiBorKCFcHJOexomvM66i3Vq8OTwnl+rD eZhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="Mj9KYt/E"; 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 b145si1208494oii.67.2020.01.23.10.49.18; Thu, 23 Jan 2020 10:49:31 -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=@linux-foundation.org header.s=google header.b="Mj9KYt/E"; 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 S1728939AbgAWSsC (ORCPT + 99 others); Thu, 23 Jan 2020 13:48:02 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:45903 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728809AbgAWSsC (ORCPT ); Thu, 23 Jan 2020 13:48:02 -0500 Received: by mail-lf1-f65.google.com with SMTP id 203so3100756lfa.12 for ; Thu, 23 Jan 2020 10:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nTTlf7PIq8m+h1b8hl1eM7lP8o081tv0+h5Byplabe4=; b=Mj9KYt/E2aNDAWdYyMNCrPSCFRO71sOFNKIv1qcIG2H25vJy2SyD3sMLVq4FaDcfeP iGlcEsouR1fuzQs9IjFsmMH6TyLgOGNtzw0PWZ+6esf3f+uNHjTwy2QjoAL8divZL0PF 0AN44j8uLfXOosmSCqaAgRkchGVu+6EMdfKNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nTTlf7PIq8m+h1b8hl1eM7lP8o081tv0+h5Byplabe4=; b=rfh7CdP2eAS/ZqAXXfOsYaZVRZuKRDuQflmYll8jcn5Usq791YwynD/IW3Y1XMk+Mb f8/rTBnntf1MWTa7A83t2z3+TNSWpYsfwgLGiUCHOJHtfB5NWbb5UEtx8s66hujZ/LE5 d+Wn9W3kYTd4xEag5XvOGh9JyhA4nypnXQfenTBL49g+GiIUBohnVBz3HYtJPnBA7JaY xQwICrWXr2O7/T2rm5qnIc6x7qbJUMHwRRKDbijo4DpSEO/gJ0j0Htad5WDx1zhgBM2S B6Hjl2/rH20yzndR9ActI/YZ1NhvQLl4IDBdy1OrVDpLuvUa38APRjuFytl4/e4KsBu7 MCkw== X-Gm-Message-State: APjAAAUrqcGuuiGrR9CYFI+SjN+MBnCIa40WByANs+gUg32vHjoId7Nf VaVVBwwLvIkatJDRMUktxmAOntTuG9w= X-Received: by 2002:a19:c697:: with SMTP id w145mr5444905lff.54.1579805279417; Thu, 23 Jan 2020 10:47:59 -0800 (PST) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id b20sm1719610ljp.20.2020.01.23.10.47.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jan 2020 10:47:58 -0800 (PST) Received: by mail-lf1-f43.google.com with SMTP id y19so3110546lfl.9 for ; Thu, 23 Jan 2020 10:47:58 -0800 (PST) X-Received: by 2002:a19:4849:: with SMTP id v70mr5482335lfa.30.1579805278133; Thu, 23 Jan 2020 10:47:58 -0800 (PST) MIME-Version: 1.0 References: <70f99f7474826883877e84f93224e937d9c974de.1579767339.git.christophe.leroy@c-s.fr> In-Reply-To: <70f99f7474826883877e84f93224e937d9c974de.1579767339.git.christophe.leroy@c-s.fr> From: Linus Torvalds Date: Thu, 23 Jan 2020 10:47:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() To: Christophe Leroy , linux-arch Cc: Andrew Morton , Linux Kernel Mailing List , linuxppc-dev , Linux-MM 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 On Thu, Jan 23, 2020 at 12:34 AM Christophe Leroy wrote: > > The range passed to user_access_begin() by strncpy_from_user() and > strnlen_user() starts at 'src' and goes up to the limit of userspace > allthough reads will be limited by the 'count' param. > > On 32 bits powerpc (book3s/32) access has to be granted for each 256Mbytes > segment and the cost increases with the number of segments to unlock. > > Limit the range with 'count' param. Ack. I'm tempted to take this for 5.5 too, just so that the unquestionably trivial fixes are in that baseline, and the infrastructure is ready for any architecture that has issues like this. Adding 'linux-arch' to the participants, to see if other architectures are at all looking at actually implementing the whole user_access_begin/end() dance too.. Linus