Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1923941rdh; Tue, 26 Sep 2023 07:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4xbugFaGVuTpGECA29a0UHODQglkiHipr27xnj0jUUd7OKA9fgHm2lsRAFofaSqsKnjp1 X-Received: by 2002:a17:902:db06:b0:1c0:cbaf:6954 with SMTP id m6-20020a170902db0600b001c0cbaf6954mr4410198plx.25.1695738573923; Tue, 26 Sep 2023 07:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695738573; cv=none; d=google.com; s=arc-20160816; b=IKxGKjHBkYKImYym8Ri4QmJ/Rf2FPVa5nJdBLSQB2zMnjsHkB/PRRTKnCLMWel2gpF XqCy7n5n1vFemEW+xf/wwF5b1ejwaVPOrXYJ8cO14KSq1VPy43mzEskkJkZQKCAo2BEd CvuXz65v/jX7+Jv5/SIS/2sHSiDWM6Z0R34YV0Lhmm7eljG4vQo/5JQy3UIKOiXrgNCA PJVh7jTZJN4iR9H3yZSopGwZUrv+HsOo+/DjoxmMVd7rHDSZRx5Xb9PJAf81+B6Kgpto Jx6OuPO/5Crjgqje5frg17BMdniwgvgvInvqhlhKSPAKxeZVm+zUM7Hh09AP33/2TQgj RsZg== 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:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=20uIU8RxlSWPD/xEPFFfvDrNIPmVI0rBNaThFpifypA=; fh=EX0H8Gt8VFWjpdeoGDfmJQBaI322cUvEEsvYcOMeB8c=; b=IaGJwTolSMOQafIDjZ1uGxH0C91PkQbw9OKMIjWB09YQPCo5SVP7tlP6urux0ihFhb Mpw1TbR1zcSdf/8IYaz0fhdsMy+ZTMwsn0x5vZTYu7SsP5kjTwOacRRJCn4EcksZttA0 jezsDaiARBFJv7chu6Y9NwLDWFwe6Nlwjfp4VojtFuuTbxQYGykUNF/Dq8nlOZl0Mn28 nmep6iontrykKwmhwFYnDynmOmBZ3DUpM6ze89T2QzB0NC8G08R6AJFdfugkDJ/ZmRes ywu2V+7IbMLYyvYTXGhdLR2UT0LKhRtwQ9NOWBJ+puQNdkcROl//MbOpAR/BYOG6yoso /ehg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q34PFOdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m8-20020a170902db0800b001c41515c4c7si4412935plx.115.2023.09.26.07.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q34PFOdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0917F81A328C; Tue, 26 Sep 2023 07:27:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbjIZO1e (ORCPT + 99 others); Tue, 26 Sep 2023 10:27:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbjIZO1c (ORCPT ); Tue, 26 Sep 2023 10:27:32 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5613101; Tue, 26 Sep 2023 07:27:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EE5BC433C7; Tue, 26 Sep 2023 14:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695738445; bh=20uIU8RxlSWPD/xEPFFfvDrNIPmVI0rBNaThFpifypA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=q34PFOdLKHXMML68+1D7SSnXjJ77WVTdMrxfRBDE389Q7MJwMN4L9x7VXL4hMgAXN cQnAjVOQJiDtMFyvqNXuc7HTey+mI4XougBv/8AmHlqngWihlCW7hgy1F57wgabghb B4CU8voNkkUm09CHYiFeBp3Dr2iSj16vWLd9BeaMdEPVmLvb2EI3ympZbd2pCKZesc YfxbOPiyduXKuISsSK/R8tZU454Cf96Hc2nABOkhWvotqZb3gvUvS1Edmt7UAieaFD Ig9voDaA3ti0cBc1ih30BNqt6Ide5C5X2T4qstpGnjhSAQ4xohgk6Tkc+gGXLhWKy7 eXKyQdALGy9Cw== Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-1dceb2b8823so2712270fac.1; Tue, 26 Sep 2023 07:27:25 -0700 (PDT) X-Gm-Message-State: AOJu0Yz7GVTekff9lRNNznfMdFDDjR3uzN+jnthU6J7koJmFnXfT5PLV pg7ajbZq9M2Wp2DyfHYxyFt/8hbKvBEczqUpOnU= X-Received: by 2002:a05:6870:6984:b0:1d5:8d6a:18f0 with SMTP id my4-20020a056870698400b001d58d6a18f0mr1592336oab.27.1695738444682; Tue, 26 Sep 2023 07:27:24 -0700 (PDT) MIME-Version: 1.0 References: <20230925110023.1796789-1-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Tue, 26 Sep 2023 23:26:48 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ARM: fix get_user() broken with veneer To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 26 Sep 2023 07:27:34 -0700 (PDT) On Tue, Sep 26, 2023 at 8:37=E2=80=AFPM Ard Biesheuvel wr= ote: > > Hello Masahiro, > > Thanks for getting to the bottom of this. > > The patch looks correct to me, but could we please drop this huge > commit log text? The AAPCS simply states that a BL instruction might > clobber IP, so any inline asm that contains a BL should have IP in its > clobber list. In our case, the use of PIC veneers is what might cause > this, so we should mention that as well. But your entire journey to > get to that conclusion is not something that deserves to be included > in the git commit log forever, imho. > > So with the commit log trimmed: > > Reviewed-by: Ard Biesheuvel Is this commit log OK? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The 32-bit ARM kernel stops working if the kernel grows to the point where veneers for __get_user_* are created. AAPCS32 [1] states, "Register r12 (IP) may be used by a linker as a scratch register between a routine and any subroutine it calls. It can also be used within a routine to hold intermediate values between subroutine calls." However, the bl instruction buried within the inline asm is unpredictable for compilers; hence, "ip" must be added to the clobber list. This becomes critical when veneers for __get_user_* are created because veneers use the ip register since commit 02e541db0540 ("ARM: 8323/1: force linker to use PIC veneers"). [1]: https://github.com/ARM-software/abi-aa/blob/2023Q1/aapcs32/aapcs32.rst =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 Best Regards Masahiro Yamada