From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6645C43460 for ; Mon, 17 May 2021 21:06:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A85A860FF1 for ; Mon, 17 May 2021 21:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244669AbhEQVHv (ORCPT ); Mon, 17 May 2021 17:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234755AbhEQVHv (ORCPT ); Mon, 17 May 2021 17:07:51 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CFAC061573; Mon, 17 May 2021 14:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:References:To:From: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description; bh=2TDKkBN6SV0x24tFeAix5kGdHqOO+EnI0tPPH83A3vk=; b=RlEW26hyYy9WpbRMkz5X/lMIs7 96zX66J/IxJ4YUCFezHVtNNzcx6I5pi3YHSLwVd7gjp+jLJzO409e5tB+p3KqY+XDGebESSrpaLKy XjD5lgOXnbEfXQ2YKs81czv6HDO82RXRyc9VugChp5Dsqwj3TXwGVmdlDUMQWzqZaPYSRPK7kPJjM HsYZtuFDToO+4U5vxIjLcrDaIO84HhNyNOQZnkzi6Lax4pJirUY+PCFXonwZv+A5SlwbQtdatiitC gzuVc+Jr17soIDM3Tayb0oXSaZpsDTcin/+qtk66rEkxCUIWKAO0mORJst/mI5asBeamwKCjTiwmq YbEosVvw==; Received: from [2601:1c0:6280:3f0::7376] by bombadil.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1likRe-00E9SR-8T; Mon, 17 May 2021 21:06:34 +0000 Subject: Re: Fwd: [EXTERNAL] Re: ioctl.c:undefined reference to `__get_user_bad' From: Randy Dunlap To: Steve French , CIFS , linux-fsdevel , LAK References: <202105110829.MHq04tJz-lkp@intel.com> Message-ID: <5b29fe73-7c95-0b9f-3154-c053fa94cb67@infradead.org> Date: Mon, 17 May 2021 14:06:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org [adding back linux-arm-kernel; what happened to it? ] On 5/17/21 2:04 PM, Randy Dunlap wrote: > On 5/17/21 10:13 AM, Steve French wrote: >>> If you fix the issue, kindly add following tag as appropriate >>> Reported-by: kernel test robot >>> >>> All errors (new ones prefixed by >>): >>> >>> arm-linux-gnueabi-ld: fs/cifs/ioctl.o: in function `cifs_dump_full_key': >>>>> ioctl.c:(.text+0x44): undefined reference to `__get_user_bad' >>> >> >> >> >>> # CONFIG_MMU is not set >>> >>> and arch/arm/include/asm/uaccess.h does not implement get_user(size 8 bytes) >>> for the non-MMU case: >> >> I see another place in fs/cifs/ioctl.c where we already had been doing >> a get_user() into a u64 - any idea what you are supposed to do >> instead? Any example code where people have worked around this. > > Hi Steve, > > This change in cifs_dump_full_key() makes it build OK: > > - if (get_user(suid, (__u64 __user *)arg)) > + if (get_user(suid, (unsigned int __user *)arg)) > > > That is what the other call uses: > > case FS_IOC_SETFLAGS: > cifs_dbg(VFS, "cifs ioctl FS_IOC_SETFLAGS:\n"); > if (pSMBFile == NULL) > break; > tcon = tlink_tcon(pSMBFile->tlink); > caps = le64_to_cpu(tcon->fsUnixInfo.Capability); > > if (get_user(ExtAttrBits, (int __user *)arg)) { > rc = -EFAULT; > break; > } > > However, my reading/understanding is that the one immediately above > is incorrect, as is the -/+ patch above it, since get_user() gets its > data size (1, 2, 4, 8) from the type of the pointer that is passed to it. > For 8 bytes (64 bits), 'int' is not sufficient, so IMO the get_user() > call that builds: > if (get_user(ExtAttrBits, (int __user *)arg)) { > is a bug. It should be: > if (get_user(ExtAttrBits, (__u64 __user *)arg)) { > and if I make that latter change in the source file, the build says: > > arm-linux-gnueabi-ld: fs/cifs/ioctl.o: in function `cifs_dump_full_key': > ioctl.c:(.text+0x14): undefined reference to `__get_user_bad' > arm-linux-gnueabi-ld: fs/cifs/ioctl.o: in function `cifs_ioctl': > ioctl.c:(.text+0x1f2): undefined reference to `__get_user_bad' > > so now both of them fail on the get_user() of 8 bytes. > > Hope that clarifies things. It tells me that arm no-MMU still > needs support for get_user() of size 8 bytes. > -- ~Randy