Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6649964ybn; Mon, 30 Sep 2019 01:15:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwil5vQMk76dKgIQh0KwtJ+dnYzEz0fHC2h6hWBAV5RknVmxTu8k/3dViPXhRuQNo0ou3nw X-Received: by 2002:a17:906:ccd6:: with SMTP id ot22mr18453891ejb.1.1569831312990; Mon, 30 Sep 2019 01:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569831312; cv=none; d=google.com; s=arc-20160816; b=OoIIghRoP+1Y1/VP8MqHxURZUDCkYU0xrS/4UqjrpUg0Jd/gLQCjlTfGfkZRA/LidQ TdNN2F4mNCEnM4tiKXDk54tLB6WwTlVSIp4Kp0IljxcfNilXapcxgEed40FL+68pwTBe fykmVRlVc6n9kFJHCZXf7hJpeHzpprIHtIGWkS3A361+75thWOUKHgI2SrEk0TDD0xKW DEsEJTaAifQMwB+x3E9impoGZGbisVzrUqLAciCzInoKVWEPV3XhwGd0Ahvw7lTDvGlk NTGzNvCE62sjbetnb2yKbJgf2EjusDdGyfaSp4fGGO5POnIASeXcR0GRemZyUXGXhI+Y c4ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=+Sifcij8n/Bk+2XUW80Jate87vwxTSDFhMR+xvlaMAM=; b=CyEN5aH42ljA80daWZeuZ9hYmRdCSK+oRziaHgOXaBL6w64aeSsGCv6Vo7nmWUPThV 5mZ1kZ6Kxn2jMyHA2Kjx7UuK+8F9y00+XVylhoDeJXUjxWpx0bwsryGxDzxrdyDBstQ5 sPPAQ1o2Jgvy6M1ZRSRg735S+YfXCOxX9MpwIWX2paU5wIU4qYTZAytoZpEyZlp6T/CC 7IdCENjyFUjcPbxoE7CFnkVpyVtQ2BZs8Nh1fjR1/qjriQhwJqxVA42kB0GJdb2MyH+s rsjkZwrgO3E4SS5LVW3kRgrAAbpRgJpTbimFoNah+SUdwmVOng4Q5rVe4tCYLP9s+d2y 7k2A== 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 k32si6672083ede.244.2019.09.30.01.14.47; Mon, 30 Sep 2019 01:15:12 -0700 (PDT) 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 S1729946AbfI3IOk (ORCPT + 99 others); Mon, 30 Sep 2019 04:14:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:59612 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbfI3IOj (ORCPT ); Mon, 30 Sep 2019 04:14:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 292E2AF43; Mon, 30 Sep 2019 08:14:36 +0000 (UTC) Message-ID: <7429d35ebf2115ee9020bd261f504858c3419486.camel@suse.de> Subject: Re: [PATCH] ARM: fix __get_user_check() in case uaccess_* calls are not inlined From: Nicolas Saenz Julienne To: Masahiro Yamada , linux-arm-kernel@lists.infradead.org, Russell King Cc: Linus Torvalds , Olof Johansson , Arnd Bergmann , Nick Desaulniers , Julien Thierry , Russell King , Stefan Agner , Thomas Gleixner , Vincent Whitchurch , linux-kernel@vger.kernel.org Date: Mon, 30 Sep 2019 10:13:57 +0200 In-Reply-To: <20190930055925.25842-1-yamada.masahiro@socionext.com> References: <20190930055925.25842-1-yamada.masahiro@socionext.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-IeFRuNA2cBG/0U7j0WPi" User-Agent: Evolution 3.32.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-IeFRuNA2cBG/0U7j0WPi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-09-30 at 14:59 +0900, Masahiro Yamada wrote: > KernelCI reports that bcm2835_defconfig is no longer booting since > commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING > forcibly"): >=20 > https://lkml.org/lkml/2019/9/26/825 >=20 > I also received a regression report from Nicolas Saenz Julienne: >=20 > https://lkml.org/lkml/2019/9/27/263 >=20 > This problem has cropped up on arch/arm/config/bcm2835_defconfig > because it enables CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler tends > to prefer not inlining functions with -Os. I was able to reproduce > it with other boards and defconfig files by manually enabling > CONFIG_CC_OPTIMIZE_FOR_SIZE. >=20 > The __get_user_check() specifically uses r0, r1, r2 registers. > So, uaccess_save_and_enable() and uaccess_restore() must be inlined > in order to avoid those registers being overwritten in the callees. >=20 > Prior to commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING"), the 'inline' marker was always enough for > inlining functions, except on x86. >=20 > Since that commit, all architectures can enable CONFIG_OPTIMIZE_INLINING. > So, __always_inline is now the only guaranteed way of forcible inlining. >=20 > I want to keep as much compiler's freedom as possible about the inlining > decision. So, I changed the function call order instead of adding > __always_inline around. >=20 > Call uaccess_save_and_enable() before assigning the __p ("r0"), and > uaccess_restore() after evacuating the __e ("r0"). >=20 > Fixes: 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING") > Reported-by: "kernelci.org bot" > Reported-by: Nicolas Saenz Julienne > Signed-off-by: Masahiro Yamada > --- Thanks! Tested-by: Nicolas Saenz Julienne --=-IeFRuNA2cBG/0U7j0WPi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2RuUUACgkQlfZmHno8 x/4mGwf/TjOB2oFr8aZFVmRpUy6wdYJ/WjWJWgFRQxJCX2lTjIb8JfDUQB7dXcDl AzNED/mYYtw7i0J6gOQPqBe/wGWY1kWndS1raRy0VuhYqKrpY9hsrzPkTXfQ6n+Z P+YSlBElpDShLqC+b3ZNnidYo4yvhQDh1KfOD+tl4qNEVmPvDcDWpGOgNSIsFqnc DO9kEVOzQg5kY+O0w/ds65s4Lq1TEYgMdUI5RKTP77k79lH0u3agDCXqJqzQySxx hEbSJtcJAWRsrmUGMmbOgyab4BgMOi6hBhP3jscVCq660dwrBqBGQ2E2Sex3v+ok SYQ0+Fu7K8JNggyWSwqswtxTkbaP4g== =OhtC -----END PGP SIGNATURE----- --=-IeFRuNA2cBG/0U7j0WPi--