Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3603337ybv; Tue, 25 Feb 2020 04:12:07 -0800 (PST) X-Google-Smtp-Source: APXvYqwwUPQllXBab/+0vvcrfprJX2NyIP9VqiqzYMTRHwwoEg0UhiX/g5KfKWrzMjVl8xWNd5OG X-Received: by 2002:aca:44c1:: with SMTP id r184mr3068367oia.151.1582632727269; Tue, 25 Feb 2020 04:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582632727; cv=none; d=google.com; s=arc-20160816; b=G/SImyeBkVf3xj0672vsFj2Sq9eQRwDwF4AoxkVjdNvraqxrnA/gBgSrIm7yZ+jEOv 4shmhOjdoJW39xoSA+1rMejG1H8VaiSXK9YRbIbe7h/Xg0Qw+MliNShTQ1wGeq6mCwU2 nFW0vrXQOjs2mf/uB3RRx9xrsiHQ+vrEqAkBcDy91AlZ+9IXOgC+1Rmr50vccCEAYIxl T5o/b60aQXytiiWseN47JF6c/qFxSV7FZIINuDpv2rg3EAYLT2rYcEPqTDp+NQxaVVJc PlDbbzSad51W2tj28Tc9xIFsbmSbzdSjHT15kXsROgqJ2uQiwn7PYAIPStOoFLXlglwB hSrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=amLdtqrx0ojmKT4nM/d5W9wxVISKSMxYfil/1PIcGLo=; b=WOBAJQvryTacQmt9WIbwIIc5T5Xkf/k+IWdHV4zWSpJQJAg0+rPtUSzkbkBupR/atp ALMv8CXdprj/3q/TE9cca55nONVs/JWaPLMYf/HsFEVkpRT3XUkvPOm4pJel9Ndxr7fq kzBBUPlr/iNQrbL+NTB31HY3Fa02CYteiwVOMxjT8nbYXNRIjEztpT638Gyh5uKX1xwi oHrTvI7dF01ax3uLUUAgReBGsOSOaTChC4Oueug5dIwlygi1QXH4Lc2ovIix+bwEvQ/F 9ThJFUUp+ixj1WFGMc3cWqK3+RB69nfC1F9hUIRjdLcMwq3dKVjK0D8I3WVFlckWkywu nTDQ== 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 q25si8276228otg.128.2020.02.25.04.11.54; Tue, 25 Feb 2020 04:12:07 -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; 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 S1730208AbgBYLwr (ORCPT + 99 others); Tue, 25 Feb 2020 06:52:47 -0500 Received: from foss.arm.com ([217.140.110.172]:49668 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729976AbgBYLwr (ORCPT ); Tue, 25 Feb 2020 06:52:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2AF2A1063; Tue, 25 Feb 2020 03:52:46 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E589E3F6CF; Tue, 25 Feb 2020 03:52:43 -0800 (PST) Date: Tue, 25 Feb 2020 11:52:41 +0000 From: Catalin Marinas To: Macpaul Lin Cc: Matthias Brugger , Shen Jing , Sasha Levin , John Stultz , Andrzej Pietrasiewicz , Vincent Pelletier , Jerry Zhang , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Mediatek WSD Upstream , CC Hwang , Loda Chou , Al Viro , stable@vger.kernel.org, andreyknvl@google.com Subject: Re: [PATCH v3] usb: gadget: f_fs: try to fix AIO issue under ARM 64 bit TAGGED mode Message-ID: <20200225115241.GB2410978@arrakis.emea.arm.com> References: <1582472947-22471-1-git-send-email-macpaul.lin@mediatek.com> <1582627315-21123-1-git-send-email-macpaul.lin@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1582627315-21123-1-git-send-email-macpaul.lin@mediatek.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2020 at 06:41:55PM +0800, Macpaul Lin wrote: > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index ce1d023..728c260 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > > #include "u_fs.h" > #include "u_f.h" > @@ -826,6 +827,10 @@ static void ffs_user_copy_worker(struct work_struct *work) > if (io_data->read && ret > 0) { > mm_segment_t oldfs = get_fs(); > > +#if defined(CONFIG_ARM64) > + if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI)) > + set_thread_flag(TIF_TAGGED_ADDR); > +#endif > set_fs(USER_DS); > use_mm(io_data->mm); > ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data); I really don't think that's the correct fix. The TIF_TAGGED_ADDR is a per-thread property and not really compatible with use_mm(). We've had tagged pointers in arm64 user-space since day 0 and access_ok() would have prevented them, so this config is not something new. For some reason, adb now passes them to the kernel (presumably because user-space makes more use of them). If you have strong reasons not to fix it in adb, the next best thing may be to untag the addresses in the usb gadget driver. -- Catalin