Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2244773ybi; Mon, 1 Jul 2019 08:39:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVByAOATVl6CBBOxDPRj54IViHGuEEyGqIbwIrdXc78nTMpIv6jMKZrv3ih4nCA45HSinH X-Received: by 2002:a17:90a:a09:: with SMTP id o9mr31851613pjo.95.1561995540037; Mon, 01 Jul 2019 08:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561995540; cv=none; d=google.com; s=arc-20160816; b=KsDrRNQLSE3TuuiYG/N4pvniky5gWcEj2jkmx7LT1JvEjZ0B3zorKL8RlpZX0LkTIJ 9T3KUFO13l8HTLHlUEUyDeg+ARhXvdC/kgyTDsP8z4scIRPlsJUC4nXk7T7kct62wCtC TWRnn9GljS9GpnvtH/yJyQKszVN0EybicDaU1ZV0mLwtOs3H43moKB9z/VFUCzjbyf9j HfCpoPj6NuWhgIYUpLeqFdg2OSWRwHyCxmO5U9vD4S2d3bYwZa+jQs0O0niFHjSmUmTU Ves2sZ4bTnOXmy9fN8EhkO2lHIEKec4kykIUboK69R5HXdBbeBKgHWf+7+4oFnaAsh0k xx8A== 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; bh=wYPUdrH4rwqGcTGw5ZdGUH3QSotQNpnBmXpSrhpI2OY=; b=poG4nIQfFk5jmmk3Q2YT345EQG/+O4Zu5+H2oKh/HT/KoqJmYz+JRMuiOgI3m4WpJe t7Cd8wZkTvxWaKB2ZbA3uDdRaPoId1GUhetA7YYtS89z27oQb7JbHC4/qmvOx3m0UD2G idgak+20l8H/CiMWjItc78r9WqzBdCHgHMKMzyyoetqsg+Yjai6tXLLGy1NLGuSU26sh icSgPK9GhUblwC+8rCCHrBsCMWMnZl/BFbGx6kciu+e8LmEeJzVW07mjkr2lk06qylI9 kvwRcYJ8XX2YfE8cAc77olM/PN380ehGpepcepTfe6h+UJLSxL7D8cRWhlJ1VZXgeZZz r9sQ== 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 b5si11407034pfd.273.2019.07.01.08.38.43; Mon, 01 Jul 2019 08:39:00 -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 S1729391AbfGAO6l (ORCPT + 99 others); Mon, 1 Jul 2019 10:58:41 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:40489 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbfGAO6k (ORCPT ); Mon, 1 Jul 2019 10:58:40 -0400 Received: by mail-qk1-f193.google.com with SMTP id c70so11209226qkg.7 for ; Mon, 01 Jul 2019 07:58:39 -0700 (PDT) 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=wYPUdrH4rwqGcTGw5ZdGUH3QSotQNpnBmXpSrhpI2OY=; b=Lxmr3+bz+HOS0pCs+dHq91z7fZlgt2JBJodz4/kiPg+4oMOVPTWr/ZiJDoFYXSLiGP zKSlJ80lEIXUm+5lsAZoWGQGGo2w/3gpQqvfoYuxFLH0d4zRP2PohPyYSz5eh1eehXkh 3i1qhDV6lYBiCImmduB/yFX0/erEtDgc26zNgYI5OQ4UiZtJknXAZ/s8DfxDvstKc5Ul ekYOYF2t4j2230LbpKM0d5I2OZmhpyiLT7E/WApVNk67Hgtzo0efigblJIt6n5fw2mX9 vz54gaizw+ImPolDytliwNIj6aUnRubaCBGWWDJhVxTIIWWBMnIMXLY0bPlifkvd6Vc6 T00g== X-Gm-Message-State: APjAAAVNXwK3XENUoUVyYdwwBQcHI5xb83NRsBn3o1MyWnhRPuc+tTFT XQ6zJWUiJr7ByElL+sjhxn6s6Tnia1wx7SpyY1M= X-Received: by 2002:a37:76c5:: with SMTP id r188mr20631949qkc.394.1561993119317; Mon, 01 Jul 2019 07:58:39 -0700 (PDT) MIME-Version: 1.0 References: <20190628104007.2721479-1-arnd@arndb.de> <20190628124422.GA9888@infradead.org> <20190628131738.GA994@infradead.org> <20190628175835.hwzfrgrtwphi6kka@shell.armlinux.org.uk> In-Reply-To: <20190628175835.hwzfrgrtwphi6kka@shell.armlinux.org.uk> From: Arnd Bergmann Date: Mon, 1 Jul 2019 16:58:23 +0200 Message-ID: Subject: Re: [PATCH] f2fs: fix 32-bit linking To: Russell King - ARM Linux admin Cc: Christoph Hellwig , Jaegeuk Kim , Chao Yu , Qiuyang Sun , Sahitya Tummala , Eric Biggers , Wang Shilong , "Linux F2FS DEV, Mailing List" , Linux Kernel Mailing List 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 Fri, Jun 28, 2019 at 7:58 PM Russell King - ARM Linux admin wrote: > > On Fri, Jun 28, 2019 at 04:46:14PM +0200, Arnd Bergmann wrote: > > On Fri, Jun 28, 2019 at 3:17 PM Christoph Hellwig wrote: > > > > > > On Fri, Jun 28, 2019 at 03:09:47PM +0200, Arnd Bergmann wrote: > > > > I came across this on arm-nommu (which disables > > > > CONFIG_CPU_SPECTRE) during randconfig testing. > > > > > > > > I don't see an easy way to add this in there, short of rewriting the > > > > whole __get_user_err() function. Any suggestions? > > > > > > Can't we just fall back to using copy_from_user with a little wrapper > > > that switches based on sizeof()? > > > > I came up with something now. It's not pretty, but seems to satisfy the > > compiler. Not a proper patch yet, but let me know if you find a bug. > > Have you checked what the behaviour is when "ptr" is a pointer to a > pointer? I think you'll end up with a compiler warning for every > case, complaining about casting an unsigned long long to a pointer. I have built lots of kernels using this patch as a test, though my autobuilder is currently configured to use clang-8, and other compilers or versions might show more warnings. > > uaccess_restore(__ua_flags); \ > > - (x) = (__typeof__(*(ptr)))__gu_val; \ > > + (x) = __builtin_choose_expr(sizeof(*(ptr)) == 8, \ > > + (__typeof__(*(ptr)))__gu_val8, \ > > + (__typeof__(*(ptr)))__gu_val); \ > > } while (0) The __builtin_choose_expr() here is supposed to take care of the case of a pointer type, gcc and clang should both ignore the non-taken branch and only produce warnings for the case they actually use. Arnd