Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4986378ybl; Wed, 22 Jan 2020 08:14:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzuSEtuhcOhVJMNgRefKfoWS9mW17AcyvEIVMkWJMF3iW1mAfKDoS6IDN3Dvus2PhYTs1cg X-Received: by 2002:a05:6808:24e:: with SMTP id m14mr7456440oie.168.1579709691733; Wed, 22 Jan 2020 08:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579709691; cv=none; d=google.com; s=arc-20160816; b=B1cWABk4+ty8Sp+A5MKbeLEgkYLN50nJyd+6J6LtcukanJ4UhKn1x0VFySsHch+jpl 68m7u2urGsZnAvZf+AQD7tULDi7Q48qns+PJ9vyMsuwg5/8Pdw1UsiaM0sR9dbKo04v1 5juMffFX1sB6D64QvGcTYfU7VDsLh7JqdKbrpW8M/gjVy5IBLsqF7ezMDSQTxV/H30PS GmwM7LAkXceG76+InF0lL7bAopWMN286Oz/HVPdiIu3MoNoUsmnILtYMVIGOh0T/EDmJ gPBQv6C/lj4U5jnIFRDU49GmTGRjGtVAEESYdsQxrWU09zY9xer8szQ3r9Dv21yBaVgD VHIQ== 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=PxCSo2JcEGlTJhdmVOOHLpuyjFAWieC3FhzbX6ms3Bk=; b=F5Et3T0A7GcVAJS1c2ojuW9GkPL0TV9bRdONO6te89nOacFpf4b+wQPruWjfCjqz9K 1fTpssA2Ta89ye1fRQsNxFhrj0k73ibiaiBLWlUnpbI9ox8fvEhWxn/rw/2y+kpXZF9Q WYIWL+qPXt6OICD8hu5TTSc47e+RNl0oiJDJGCz6qmQ9OpaaGLqc4ioFDKRT0B7+7Kbg 990uqBrAI7ao8Mi89QHuoFNnqliVw3U6suKK9kUgYm15FTl7sluTqIG+irDTasCXkYDd /hYtmudXeiJpNeCiD0CS3T4DuMGxCehhGDk9d6Dr7wXZo5fVcrxVi3b44frhWu6Uur4x OCsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="WVzg/4mZ"; 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 l204si21007370oig.31.2020.01.22.08.14.39; Wed, 22 Jan 2020 08:14:51 -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="WVzg/4mZ"; 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 S1726231AbgAVQNd (ORCPT + 99 others); Wed, 22 Jan 2020 11:13:33 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40214 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgAVQNd (ORCPT ); Wed, 22 Jan 2020 11:13:33 -0500 Received: by mail-lj1-f194.google.com with SMTP id n18so2507670ljo.7 for ; Wed, 22 Jan 2020 08:13:32 -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=PxCSo2JcEGlTJhdmVOOHLpuyjFAWieC3FhzbX6ms3Bk=; b=WVzg/4mZaQ3ubctvikpmoB2+8YZnmRK2+VSYiWGQ33nJZL1OeIGMyFE3sBcuqoQVbi rwpNneTfpLB3RAwTWttAZsxz4mdwPNf2Y8+kgY4tYIeLbjPU7jrBtLrLWh4mnN0ddI2k Y06yr95wD8GFqmmXgcgeinrku41v7nODIWRxw= 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=PxCSo2JcEGlTJhdmVOOHLpuyjFAWieC3FhzbX6ms3Bk=; b=S+nrBoHN1ziI3NkYcZGPwy3eGj0+sVjiCTo/KgaIUxXT8hGzfYi2E8HKfWfrHI5UUz /aPzM4k3jiCGUIxhI+LPA+YSfSuWoCDwe4gwy2ROOLs2GzBjs7IRQkV+7oMJdsWNZc+K 8yFiF/ZDZYLUqUa52Q7LUxGCLrpjHJ0oRq+gBkwkSAC/6pQHmY+B2jN9fFUgz/wnCoaL R4X7C/9lB4zu1j/QZVM5zFs185GH7xr/8Dki9k/RdSePCAUA4nwMKojdMLq/k7+N3mm0 D2cJxHCWmkm3rN0wz+cHZCkhh0WBSzESM03vWUiFlfQCkwZ56gutfla5KSrnx+L5JlUz s3tw== X-Gm-Message-State: APjAAAVz09YZis16kkqhVTctfJRTAOMDnmTWeI7P7goG4qw0O846ZHMS u3fu2XiWTccC+pny85BS/UVRNVakE54= X-Received: by 2002:a2e:a37c:: with SMTP id i28mr18955908ljn.118.1579709610232; Wed, 22 Jan 2020 08:13:30 -0800 (PST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id w8sm20746978ljd.13.2020.01.22.08.13.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jan 2020 08:13:29 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id y6so7486061lji.0 for ; Wed, 22 Jan 2020 08:13:28 -0800 (PST) X-Received: by 2002:a2e:9510:: with SMTP id f16mr19943444ljh.249.1579709608444; Wed, 22 Jan 2020 08:13:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 22 Jan 2020 08:13:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/6] fs/readdir: Fix filldir() and filldir64() use of user_access_begin() To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Alexander Viro , Andrew Morton , Linux Kernel Mailing List , linuxppc-dev , linux-fsdevel , 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 Wed, Jan 22, 2020 at 5:00 AM Christophe Leroy wrote: > > Modify filldir() and filldir64() to request the real area they need > to get access to. Not like this. This makes the situation for architectures like x86 much worse, since you now use "put_user()" for the previous dirent filling. Which does that expensive user access setup/teardown twice again. So either you need to cover both the dirent's with one call, or you just need to cover the whole (original) user buffer passed in. But not this unholy mixing of both unsafe_put_user() and regular put_user(). Linus