Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp851190ybf; Fri, 28 Feb 2020 08:50:19 -0800 (PST) X-Google-Smtp-Source: APXvYqz6Sb5jPXK4ytOaWMWYpTOeE6beYPqZUUtB2sgQaKkrz2Tlecf1qw+nEQJyXp/aF/m9ItWZ X-Received: by 2002:a05:6808:6cd:: with SMTP id m13mr3783968oih.53.1582908619403; Fri, 28 Feb 2020 08:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582908619; cv=none; d=google.com; s=arc-20160816; b=YW/O7KBaYU9qEOT8nHSghAUNvUOIq0OjsqV9nRNPMVDup+B7ZuWJUIv8HF6ej8UlWQ I4HUUsuF/gco3+FneAfaIyuJfZbh3il+e7s2ABaYci9RIEw0RIddhNt+gBZOoKmtvVY/ dURQssxd//6bHBFlHIJkHwEFkAcfyIRoME5+DZhrJxDVKxE0Vcn8y7vNDpS4SEqOeqyE 4oq77i2Yroli5J9eosbBoex1gCkVFUetKXnFWLcIS58QVuKJAwWRLlBCvFYpGWmIL6ae SrCOpDNBMThO76Kql8hboEiXt/CSGlbuztoMzcStJYwQQLFf+ZQ9fYBcCo+xgqYzMSIl EWyw== 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=6ITC8VOvo79wziySKTh1FKxnyJ5W4iS3BWjWwnwPYmA=; b=E4m0kJ1afkiD6vRXnLAARReVzV+fr2m0M3Ty93eBnjWyk7R2AnKRPbe3fAG+H45s5P bzxsYJUjMI8OIFK8zxUK1pFgG7qdCrgP6ej4r92stu+0ub7HBw2pxDzmNqXhwnlg5UrA 9Hw4IDzjbRQrVI7MFqZ1Bu/zBPMHmKu3wMJUzVm7aTt+zu7RXR4mnHJMGxY4VbN82+5A GiteDJniyPYuAx/2KlzNODP8zLIEeyZfhzcp6jCblf5E9XoWc7YWeR4G7YIw8yGQ1a6X EaUiV2UdSwTG9rCjoTwZ2/qEFVcUf0B6bdGoYHxMYYCCsnMaA+oJTPoMxEaC30dpMMzw Yc4w== 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 z15si1950722otm.168.2020.02.28.08.50.06; Fri, 28 Feb 2020 08:50:19 -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 S1726867AbgB1Qsy (ORCPT + 99 others); Fri, 28 Feb 2020 11:48:54 -0500 Received: from foss.arm.com ([217.140.110.172]:41314 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbgB1Qsx (ORCPT ); Fri, 28 Feb 2020 11:48:53 -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 6113031B; Fri, 28 Feb 2020 08:48:53 -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 D5E293F73B; Fri, 28 Feb 2020 08:48:50 -0800 (PST) Date: Fri, 28 Feb 2020 16:48:48 +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, Peter Chen , Miles Chen , eugenis@google.com Subject: Re: [PATCH v4] usb: gadget: f_fs: try to fix AIO issue under ARM 64 bit TAGGED mode Message-ID: <20200228164848.GH4019108@arrakis.emea.arm.com> References: <1582627315-21123-1-git-send-email-macpaul.lin@mediatek.com> <1582718512-28923-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: <1582718512-28923-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 Wed, Feb 26, 2020 at 08:01:52PM +0800, Macpaul Lin wrote: > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index ce1d023..192935f 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -715,7 +715,20 @@ static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req) > > static ssize_t ffs_copy_to_iter(void *data, int data_len, struct iov_iter *iter) > { > - ssize_t ret = copy_to_iter(data, data_len, iter); > + ssize_t ret; > + > +#if defined(CONFIG_ARM64) > + /* > + * Replace tagged address passed by user space application before > + * copying. > + */ > + if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) && > + (iter->type == ITER_IOVEC)) { > + *(unsigned long *)&iter->iov->iov_base = > + (unsigned long)untagged_addr(iter->iov->iov_base); > + } > +#endif > + ret = copy_to_iter(data, data_len, iter); > if (likely(ret == data_len)) > return ret; I had forgotten that we discussed a similar case already a few months ago (thanks to Evgenii for pointing out). Do you have this commit applied to your tree: df325e05a682 ("arm64: Validate tagged addresses in access_ok() called from kernel threads")? -- Catalin