Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3387363ybd; Fri, 28 Jun 2019 07:47:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTKycOEfpMdSk+ycYCwnQtxcaZIZYZfacP4RXcZxde3Yebn57X4Sbvi/LE02/YomZtUJsm X-Received: by 2002:a17:90a:710c:: with SMTP id h12mr9330136pjk.36.1561733239922; Fri, 28 Jun 2019 07:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561733239; cv=none; d=google.com; s=arc-20160816; b=I3KtBwE90IBe0e8Xi2fuwhaOQqe8vpkJ4XUg+GLD+SdUx83ybmws5mhg3Tklk3Fb6x QT51FJdP5JeXuXXbNh15aI44xkbi3RQwqEDF64cL53eaY7vC2uC0MtxVv+xxoI4/MZVv 8bbLNYZ6rHd7s2S1hHY4ZjrU6DkYEwzAb03BMq/+gHLOJ8hGdnli+P2mPmIBPYi2P6tw jOQB1bvQHnyXJ8xBer9yFCeuvgY0TIktNqikp8wM8lsfM1b7XLrA+3ZBEA18e6CHVPVP fxToFpp0h8CuyfcPPx3blgbfBisLYlmRC03rWtxLt5g2mnyQPVBgTSBVKHX7wP02mqHB J+tA== 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=ukm6QwjiR6v3c/fXg6msKYDD+XPWCXV7vWmtJTq9N64=; b=pVW28mHeG9PWmvhs2vbJeEnvsFDYWEcwKYwdL3fGxFf8gACSOxqzxqmtzbxmaPNlCC n+NLFuzMf+J3Hu/W8PUGmuav7JVP9ltmCwx+3f5/PZiwx9JF8Z67fOFgFGERfHBqJGnr +ltgPq2zxdev7ccT3NGlAR4qKEV70+GKONKGVDtUS617xHjrgvUTxuEkWcCzLAP9fERL j9Rc+i6QikHB0G8B4dQcQI18kxmt6XAg5g6P3mquJp8bl08Pv/2RYJi+agjiMaZtm69D XQxXot/pPROGUUxJ6kDTlCwLBp2IvZAwUPDaar88guNaqSp9dBuvE/h51QglL33qqeB4 nY7w== 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 m71si2446427pjb.26.2019.06.28.07.47.03; Fri, 28 Jun 2019 07:47:19 -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 S1726796AbfF1Oqg (ORCPT + 99 others); Fri, 28 Jun 2019 10:46:36 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:37015 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbfF1Oqf (ORCPT ); Fri, 28 Jun 2019 10:46:35 -0400 Received: by mail-qt1-f193.google.com with SMTP id y57so6571788qtk.4 for ; Fri, 28 Jun 2019 07:46:35 -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=ukm6QwjiR6v3c/fXg6msKYDD+XPWCXV7vWmtJTq9N64=; b=Kvzcd1sCuB2BOPjHnJeI4uvJhjNOD9fjXX5sDar/h9R/pytEhwW3UUaLzL6GII6yor J6H8j3kTH6CIrVZe6+fvbuzoGp0ipIT12tVcGk1V90aXax6zB0ZzXCf6Vxxty+rJm86/ QyQvEfWD87rBDoVpSGoH9XC+MRSZ9vV720hcwHg6BdlvaWvjpvyTR9YBi46Iy+FSqxGl 9FNhc0GEjSGF/tGwjSi8V7ZOXbU6sBVTt/qNqY5Kyl/SE6odIkPt4V8JqdnNx/2scChp ctg/6LhwsObCODus4P2ot+ulbYrUbI/XORnWg4IxWzGjDkcETg48uPfqK4NU/UDQGjgc V7mw== X-Gm-Message-State: APjAAAU7xRF02AjReAWz1Rfhv4aFcrGBpqRaY87eJDBU44M4jAyk0qAm 5ik3ekkFOW5Va7HWKrwIDUxecLtk1KD3kaXflN4= X-Received: by 2002:a0c:b758:: with SMTP id q24mr8545628qve.45.1561733194702; Fri, 28 Jun 2019 07:46:34 -0700 (PDT) MIME-Version: 1.0 References: <20190628104007.2721479-1-arnd@arndb.de> <20190628124422.GA9888@infradead.org> <20190628131738.GA994@infradead.org> In-Reply-To: <20190628131738.GA994@infradead.org> From: Arnd Bergmann Date: Fri, 28 Jun 2019 16:46:14 +0200 Message-ID: Subject: Re: [PATCH] f2fs: fix 32-bit linking To: Christoph Hellwig Cc: Jaegeuk Kim , Chao Yu , Qiuyang Sun , Sahitya Tummala , Eric Biggers , Wang Shilong , "Linux F2FS DEV, Mailing List" , Linux Kernel Mailing List , Russell King - ARM Linux 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 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. This might contain a double uaccess_save_and_enable/uaccess_restore, not sure how much we care about that. Arnd index 7e0d2727c6b5..c21cdecadf26 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -307,6 +307,7 @@ static inline void set_fs(mm_segment_t fs) do { \ unsigned long __gu_addr = (unsigned long)(ptr); \ unsigned long __gu_val; \ + unsigned long long __gu_val8; \ unsigned int __ua_flags; \ __chk_user_ptr(ptr); \ might_fault(); \ @@ -315,10 +316,13 @@ do { \ case 1: __get_user_asm_byte(__gu_val, __gu_addr, err); break; \ case 2: __get_user_asm_half(__gu_val, __gu_addr, err); break; \ case 4: __get_user_asm_word(__gu_val, __gu_addr, err); break; \ + case 8: __get_user_asm_dword(__gu_val8, __gu_addr, err);break; \ default: (__gu_val) = __get_user_bad(); \ } \ 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) #define __get_user_asm(x, addr, err, instr) \ @@ -373,6 +377,8 @@ do { \ __get_user_asm(x, addr, err, ldr) #endif +#define __get_user_asm_dword(x, addr, err) \ + do { err = raw_copy_from_user(&x, (void __user *)addr, 8) ? -EFAULT : 0; } while (0) #define __put_user_switch(x, ptr, __err, __fn) \ do { \