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 31C76C433ED for ; Mon, 17 May 2021 21:04:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F10506113C for ; Mon, 17 May 2021 21:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237435AbhEQVF5 (ORCPT ); Mon, 17 May 2021 17:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234755AbhEQVF5 (ORCPT ); Mon, 17 May 2021 17:05:57 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAA8EC061573; Mon, 17 May 2021 14:04:40 -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:From:References:To: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description; bh=ql13rlKLv4OPAWCH9i8KAWhh1VDhSbcB2pzitfM5u+k=; b=JZW+yzAiS/5wQMvnvrEPcAVuWJ B/G0SX7UMYQUzccP9r9+yabgBrKUAUdHNIsresSjUTW8sxjq7kTtE/0SOfRgY5adz023UOVOdT0pm qe9anbFwqN3rN+X9mlCH/3e+8aJij0zys0CGAtm+vxdcp+0aD/jSB/uYILGrZmMxkTvy9U9hbbhCJ gd93tZeb6WEmvjTtSVZJ2kOeM76rHcHctx1IHrmp42ddtLq/c4jQ32Ybxy3gPXBv6I5J8eMVTNS8a kBgBBiskKF+uIxZRhux2Zcxz7HROQPnuNkFPK6AUCFMBoxjYRguokrZ7zbQUmleCXS5TiSG1CRBNE eLPCCXig==; Received: from [2601:1c0:6280:3f0::7376] by bombadil.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1likPm-00E9PR-M6; Mon, 17 May 2021 21:04:38 +0000 Subject: Re: Fwd: [EXTERNAL] Re: ioctl.c:undefined reference to `__get_user_bad' To: Steve French , CIFS , linux-fsdevel References: <202105110829.MHq04tJz-lkp@intel.com> From: Randy Dunlap Message-ID: Date: Mon, 17 May 2021 14:04:38 -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 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