From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 185E4C2D0DB for ; Thu, 23 Jan 2020 18:48:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D6B5A21D7E for ; Thu, 23 Jan 2020 18:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Mj9KYt/E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6B5A21D7E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7F8F46B0010; Thu, 23 Jan 2020 13:48:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D0D66B0266; Thu, 23 Jan 2020 13:48:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E7426B0269; Thu, 23 Jan 2020 13:48:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 56E386B0010 for ; Thu, 23 Jan 2020 13:48:02 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0A77F4850 for ; Thu, 23 Jan 2020 18:48:02 +0000 (UTC) X-FDA: 76409783604.27.bread14_28f3f3dc19441 X-HE-Tag: bread14_28f3f3dc19441 X-Filterd-Recvd-Size: 4230 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Thu, 23 Jan 2020 18:48:01 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id o13so4798077ljg.4 for ; Thu, 23 Jan 2020 10:48:01 -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=at9WG6wHwo+NO4CaOayxxcdf75STW+/VP46Mkp+7aKhfBWN0U31uyPK1ahWxqRJBHs D4R3gPPHvqGccfuVFZtltcAF8AslrEoR3x+MFj6BOlCSZYHUdvBsSHTSUzmIjD1HYMQs z9EhdgIpJrMMSUbQriEUImmVjPEk9M6La9E7kXY0Jzld8Ive05DWG9TUwFoeYj+sXpY0 0XNrZqP1Xvzip1qyk2icF2XFYZxLXnNVVEVQ0/216WvJ+NQRMQWgJDkyf3yUPDK8gsWK kzxOm+t/PqSRlZ2ljRnTMJupfIxqKj5PCuQ0gPwcnULUsJOvVRddLpCdidaKrWoSk9OF qY2w== X-Gm-Message-State: APjAAAV1YD5ISXCdJiQjpra33txucR+0257bd7m/9SiuoUFsbXzKi4aU la5kICNhPQV7iWvdVTKXw8LZMOO5apA= X-Google-Smtp-Source: APXvYqy1R7V28TkfT8kh/Q1Dj/oypus2aVYle330dogdo3itgAKKiwRTtHk7ICg3ZzWyKwosyNh6Hg== X-Received: by 2002:a2e:8316:: with SMTP id a22mr23443086ljh.141.1579805279446; Thu, 23 Jan 2020 10:47:59 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id y66sm1490027lfa.53.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-f41.google.com with SMTP id y19so3110545lfl.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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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