Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp895261pxb; Fri, 22 Apr 2022 13:40:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRjTxC2PdOzlAUBaPGfkeuGyhOICOZTgrIGc6d8+XUJhbsM3AhE+0Kore6rmU5qqsbdpcL X-Received: by 2002:a17:90a:410a:b0:1cb:a279:6679 with SMTP id u10-20020a17090a410a00b001cba2796679mr18108775pjf.211.1650660048569; Fri, 22 Apr 2022 13:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650660048; cv=none; d=google.com; s=arc-20160816; b=SZ8ZwTdvU6u0gQy4goeE3swOt8i4Jhs7aFSDtXiJgK+rV4PJGpSPsTWjlyLLssybsw uPV24ntUV/YfxOt9TiLY1JrtE10nPmoA5vX75XQo2j3S7iSY4db8oRZs/+P7xDgUEJ3U RomSAiXCpjnLlBCH2SGqSVxTv26g40VWRxis2zRF1IodjZFKIJmxRJmL/AC33znyhS+c 7g1OdlAt0tURXn31DR9bLBW4PNAQJU5HjzNb9TuCFnLEYpBHRyrQukJiQ/hTUF7QXgCv IPdbQ6ibu6l9CwNiU6K785TieHWT6mDvWI517ns2SVk9oyaODR11ibZSJfLlcXZw89JK XaUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:subject:from:to :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=uOC1fW/0uuSbuGCETmD2nbnOBndFlT09OLOf26HRiaM=; b=mYIPYldChB+E9faf58aBFaeOD21VTdGtP3DKmoOYo2PvQ9ouR61q5PDWZEeqWEvgXA 9ntHGIgC7ucfWxzXscVbiDmC5WygVkcL6vW6EKL9KbItZr+61gXtMa2mtAMZQvVTLptC Q50omuaPp2PefiyDvmbafDGMvswnZJNTt11WNQ3v65LF7ELOTjnjaFWt4jG8ap4Dpn8l P7RU1fua/AztESj7D7GS+RwP/GWPpFFuhu5Sh0oixVgUxWev5low1ScFVMbMtRUujjcI 9w9ka+t3pSTqCjcnROfjYQARKLzepSWI6aqZpgeW/tdJPZL3Lm9keX8jXftsQbrhP2D1 /hoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@o2.pl header.s=1024a header.b="Iv/G25/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=o2.pl Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ob16-20020a17090b391000b001c7c48c9fbbsi10763029pjb.8.2022.04.22.13.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@o2.pl header.s=1024a header.b="Iv/G25/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=o2.pl Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B67C159497; Fri, 22 Apr 2022 12:26:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349411AbiDUUuN (ORCPT + 99 others); Thu, 21 Apr 2022 16:50:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392548AbiDUUuK (ORCPT ); Thu, 21 Apr 2022 16:50:10 -0400 Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C2E4DF75 for ; Thu, 21 Apr 2022 13:47:17 -0700 (PDT) Received: (wp-smtpd smtp.tlen.pl 20653 invoked from network); 21 Apr 2022 22:47:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=o2.pl; s=1024a; t=1650574032; bh=uOC1fW/0uuSbuGCETmD2nbnOBndFlT09OLOf26HRiaM=; h=To:From:Subject:Cc; b=Iv/G25/v63Q81fWXkDU2p/sFBgBPmyoblHSgbQHfXvSNNJOWtatD8hgKUR8jpPtkG 2uahVMDf9nKYTsIbKpW44RjV6zssoUTwqw+7Odi9cEkM7ThKOeiPz9mVWfWYXM5+eI 1CdkDmzCzEwonlRqL/N+ET80S6MoCisc0dRKLLE0= Received: from aafl13.neoplus.adsl.tpnet.pl (HELO [192.168.1.22]) (mat.jonczyk@o2.pl@[83.4.141.13]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 21 Apr 2022 22:47:12 +0200 Message-ID: Date: Thu, 21 Apr 2022 22:47:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-GB To: netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" From: =?UTF-8?Q?Mateusz_Jo=c5=84czyk?= Subject: "mm: uninline copy_overflow()" breaks i386 build in Mellanox MLX4 Cc: David Laight , Andrew Morton , Christophe Leroy , Anshuman Khandual , linux-rdma@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-WP-MailID: 15cac2a73e996b392246ccbfd184ccf8 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [8RPE] X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, commit ad7489d5262d ("mm: uninline copy_overflow()") breaks for me a build for i386 in the Mellanox MLX4 driver:         In file included from ./arch/x86/include/asm/preempt.h:7,                          from ./include/linux/preempt.h:78,                          from ./include/linux/percpu.h:6,                          from ./include/linux/context_tracking_state.h:5,                          from ./include/linux/hardirq.h:5,                          from drivers/net/ethernet/mellanox/mlx4/cq.c:37:         In function ‘check_copy_size’,             inlined from ‘copy_to_user’ at ./include/linux/uaccess.h:159:6,             inlined from ‘mlx4_init_user_cqes’ at drivers/net/ethernet/mellanox/mlx4/cq.c:317:9,             inlined from ‘mlx4_cq_alloc’ at drivers/net/ethernet/mellanox/mlx4/cq.c:394:10:         ./include/linux/thread_info.h:228:4: error: call to ‘__bad_copy_from’ declared with attribute error: copy source size is too small           228 |    __bad_copy_from();               |    ^~~~~~~~~~~~~~~~~         make[5]: *** [scripts/Makefile.build:288: drivers/net/ethernet/mellanox/mlx4/cq.o] Błąd 1         make[4]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox/mlx4] Błąd 2         make[3]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox] Błąd 2         make[2]: *** [scripts/Makefile.build:550: drivers/net/ethernet] Błąd 2         make[1]: *** [scripts/Makefile.build:550: drivers/net] Błąd 2 Reverting this commit fixes the build. Disabling Mellanox Ethernet drivers in Kconfig (tested only with also disabling of all Infiniband support) also fixes the build. It appears that uninlining of copy_overflow() causes GCC to analyze the code deeper. The code in mlx4_init_user_cqes, for reference:         static int mlx4_init_user_cqes(void *buf, int entries, int cqe_size)         {                 int entries_per_copy = PAGE_SIZE / cqe_size;                 void *init_ents;                 int err = 0;                 int i;                 init_ents = kmalloc(PAGE_SIZE, GFP_KERNEL);                 // ...                 if (entries_per_copy < entries) {                         // ...                 } else {                         // BUG here                         err = copy_to_user((void __user *)buf, init_ents,                                         array_size(entries, cqe_size)) ?                                 -EFAULT : 0;                 }                 // ...         } My setup: Ubuntu 20.04, gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) I was using lightly modified Kconfig from Debian i386 Linux packages. Greetings, Mateusz Jończyk