Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp390814ybp; Thu, 10 Oct 2019 20:36:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXBB1D9wlE8T+05LHyZ5Jy1y7hKrr4Bie5mrUeU4UhJw+WX4whObncwrojjs7moDyUd4iG X-Received: by 2002:a05:6402:751:: with SMTP id p17mr11404211edy.161.1570765006858; Thu, 10 Oct 2019 20:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570765006; cv=none; d=google.com; s=arc-20160816; b=cCLM9NPFCEo/lgARyOq1y9gKmSlqCA5ogDYqbCoeo5pbFdIr29cWjeIgejfsrE8ZEW V/i49j7vCJlSHXGTAopBrDlNFHQkznLIbXkoyVTpxDPswh92VbQSu3HH1XLNzdBETxCw JiDP4lhvHx6bAy4fQSmGEnkSfF2lmZRr69Qc0VFmem7uv0tA4bW964pg/RZGwcUXXeg5 GQ+hkOkk6/4ZWCIU/oH7di7PtZC9Y6fbPkgR1Sjfu+8tIhUfUWtDAmB+PuVG6ElP2KxV llq6lXnPS0kr6IUpphExpyd/bcuJNwt5F91DhAyxIHez4t1muSWcDlQG801Z9paPwgEp sZkA== 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=OgPaV+qaSMkdCLw3rM07i0HH191EBL2f3oOUwQ7aINM=; b=sCznii4YCJa5hRBaMSqz9Y3nJaRB9/SjEZ11MpUEbU86KQb//h2FQ78B65GjiaczJh ZkzLYpu6zMhPOTMpKB41PN03JPzBPYa9MZBChUd9373PTAyvL5DVEu7VSFxTfQ1E184/ 1pnFzgfNdYqF+/TIkeX6IO/3OvhEwtTTRIhFZADba85KAJWqgMFypGSUQIxfKBsZynOz 8nRW2gzxtQokbQKqhRYuPXVdFrdz6T7A1ujct6dI+cBqKzLR3jF78v7ZUGvVTYXKCIPp B4rnwhEjKBPZH3nES4yaZwWaX4+uszbOzVaeBoSnnGTzfnMMBY9leni/7gXulmFgB2cg YZTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xk4BT32V; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b56si4726314edb.418.2019.10.10.20.36.20; Thu, 10 Oct 2019 20:36:46 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xk4BT32V; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbfJKDfw (ORCPT + 99 others); Thu, 10 Oct 2019 23:35:52 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:36897 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbfJKDfw (ORCPT ); Thu, 10 Oct 2019 23:35:52 -0400 Received: by mail-yw1-f65.google.com with SMTP id m7so2990510ywe.4 for ; Thu, 10 Oct 2019 20:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OgPaV+qaSMkdCLw3rM07i0HH191EBL2f3oOUwQ7aINM=; b=Xk4BT32VWl7rmbedpzjSt5jXZ6YD4Nf9YCauqsxDOhZntTvKg5bpEb0RwAzy4VQMQL tlfrsMqcY0JHQAXCXq1ORbpQ5AUUP4m14X8nPaCiH3vSFvTydqmgp69cg/lKPuAoNHC5 jNL0ADF3se3LDaAQEHYC4/4T5YFmHf9sP/f+5z7VK52bZBBjpEW8dYbZubWDunkCeGbZ GpjMunMnDVe+joQv8s74lShKRZBF5901HU+bWB/7jGqTydun6sQFCo/6J9Fn0P3rA9qE FsBgquAXoC+peoEcTVVg4+lW2Mn0HYiaGpasCjhtt9nSBGTnAv/l8NbTT4MRLOCul1ER axLA== 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=OgPaV+qaSMkdCLw3rM07i0HH191EBL2f3oOUwQ7aINM=; b=Bo7gv0zL8ss0F67omA47KOGPG+Q7XGORNFZTULTZPMi1R93qZgzCQb839nXK2JB86h WoBwXs+EpWetMWNxweTukr3GSLPJwpy2HSVrACKFaEPBNKh+5K7kL5Sm8VuY3C8R2uL1 fgKXOe0+7zKGpcrXOOQxt//zO4BAiMzh2Xpn5PrOdnW5F0AH4Z4V536osLrFroPw7ypb kp8TAfQbNHnQMlZJzhNP05jMKFwUYg0bx25fMzagBfgmZjv/3AC9bepX1Ex9yg6DgEsq 0+Yi0M/uOwuieZNFcgA8+dvyimF7DRUzDWMpaTi6diLR6ZOyNDzpp9L7IGKkSMtmf6s1 5kzA== X-Gm-Message-State: APjAAAUYxeeRV5v/CrKgxELwApGsHYH+qqsJtnyP/WWfSWc8tez5Tyfs GIpYpLk6QKzJj5yvgr2+wyhuEnmPB1WPSYvu/fmOsuu3iXw= X-Received: by 2002:a81:74d4:: with SMTP id p203mr764119ywc.234.1570764950010; Thu, 10 Oct 2019 20:35:50 -0700 (PDT) MIME-Version: 1.0 References: <20191009192105.GC26530@ZenIV.linux.org.uk> <20191010015606.GD26530@ZenIV.linux.org.uk> <20191010142956.GG26530@ZenIV.linux.org.uk> In-Reply-To: <20191010142956.GG26530@ZenIV.linux.org.uk> From: Max Filippov Date: Thu, 10 Oct 2019 20:35:39 -0700 Message-ID: Subject: Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values To: Al Viro Cc: "open list:TENSILICA XTENSA PORT (xtensa)" , LKML 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, Oct 10, 2019 at 7:29 AM Al Viro wrote: > Hmm... Looking at __get_user_size(), we have retval = 0; very early > in it. So I wonder if it should simply be > #define __get_user_size(x, ptr, size, retval) \ > do { \ > int __cb; \ > retval = 0; \ > switch (size) { \ > case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\ > case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\ > case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\ > case 8: if (unlikely(__copy_from_user(&x, ptr, 8)) { \ > retval = -EFAULT; \ > x = 0; \ > } \ > break; \ > default: (x) = __get_user_bad(); \ > } \ > } while (0) > so that 64bit case is closer to the others in that respect (i.e. zeroing > done on failure and out of line). No? Ok, I agree. The intermediate __gu_val in __get_user_[no]check doesn't work well with some data types used in the kernel, unfortunately. I'll post a series with what's close to your initial patch on top of rearranged __get_user_[no]check. -- Thanks. -- Max