Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1961116rdh; Tue, 26 Sep 2023 08:21:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFIpfWmy5+Lbx8TcljtwnrLr+TEvNY6TkXpXbkukpGzyERA/3iCjHC/AQX8lwYTKhCDVJh X-Received: by 2002:a17:902:82c6:b0:1c3:8230:30d8 with SMTP id u6-20020a17090282c600b001c3823030d8mr8476003plz.38.1695741690174; Tue, 26 Sep 2023 08:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695741690; cv=none; d=google.com; s=arc-20160816; b=n2rd0+gC6bpKwDq7Pg6sNL7GUUpHSAPofiJxRpyZNdZglBFjMFL7iwdIp1owj+Vby7 9jRY5ZmRA9E+Q22kXFvIlw3Sr2NX926PlkLVcK+czyiq5QHmlO261wul2iqENxOlBJ6d fXO5OR6SA/uENuT8TI7Mqtpe4GBnJFVX6tKRNiYhjnE+OPCNNTu5E2fFEImOCm7mzQlC QqT5Rf3mnBEsYXmpFTI75OQvbHS/r0YRnTVIjt9U1uetGLmsalrMN3iT5A7ACtOD1l5P scz+Ky/ssxfHzLDjSiLFX+8wj0mmJklF8C3Dmmym4/BIUIfBOWc03ECFFdZIArqcLNO2 mPBQ== 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=hHCGzDD3Zxc5FD7vhGw1qLP3AHNwyYdkUXyjL0lcbmY=; fh=uICN3izMmj5bZjgEHruWgJa7LpDOsubB17Hvvzo0ZUc=; b=AHBkRi6GvD/pii6R4Sze8Q2+XLUGc4oHGLxjJkh/5ToFw8RoDO3eu0BN+YgqoSGGGe OGz7gusU6vA/Nte0+q1Xya4zCeBtn9mBuSFVxplbB6GnH/KZfAAT324OC6Rebl6tAwOz NTG4po9Fnfx995vWG0UdzugRjKIoL69y1CHniMiIFb7JVFn/6uU+BH3prEuPH9sb/u4U bV6xjcQkIxCdNZpnrrCc+lr82ORNLbzrVV7CxLjzJBIAIUjVFyRMl9erLaSvE7UqIjFn o2wx926J2JKAjmK2GFP1AMh3/ZEt2NY+3AwOEwIIFRNs5Ad+ZoSTLnAEzkeYipobJ61y ixmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kp7qlTr7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l17-20020a170902f69100b001bb9f190bafsi13698864plg.526.2023.09.26.08.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 08:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kp7qlTr7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id CD6D180608F8; Tue, 26 Sep 2023 08:10:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234906AbjIZPJ6 (ORCPT + 99 others); Tue, 26 Sep 2023 11:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjIZPJ5 (ORCPT ); Tue, 26 Sep 2023 11:09:57 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C311B10E; Tue, 26 Sep 2023 08:09:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A43C433C7; Tue, 26 Sep 2023 15:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695740990; bh=hHCGzDD3Zxc5FD7vhGw1qLP3AHNwyYdkUXyjL0lcbmY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Kp7qlTr7JOp9Hny+DIlGiVOJreuGhYt5mSi0bO39fLsQ+grO5SQJ0PTnUICV7LN8G ka00On3NCyZM3wRvgNwat13Nu4RI1sakIj7JsIhKoPzzj8nyVd5+iykw+cUwKA0g6N R+Xh/PbsMsxeFlkw91xwbVlSookYGwDqXxSg3M4OvBm6LfHALt6Et5Yh0BAdRXudc+ uWuF2Cp7HWaus+TTXIsZ8HtFvy9CRD6KqSf85l+juIRY+B5EkW45iWhTGoyFk1H8Oj HRFrctlpWcUL6QRpv8gdR6dEtRYCFe+lxiPK5uTEkLy3zFiLLxlKmze30F/tk8YbvG E6AqVAz/Xeh1A== Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-503f39d3236so14645941e87.0; Tue, 26 Sep 2023 08:09:50 -0700 (PDT) X-Gm-Message-State: AOJu0YyoKd+uTigjazdRzz82D0IA/FfVn72ahv9oQ9hyM2kPbn6Bh9KQ RqhFQPcgN1O8okPTfEYrYmqMxzU5tiQcXuEzNuY= X-Received: by 2002:a05:6512:2815:b0:503:343a:829f with SMTP id cf21-20020a056512281500b00503343a829fmr11191314lfb.23.1695740988547; Tue, 26 Sep 2023 08:09:48 -0700 (PDT) MIME-Version: 1.0 References: <20230925110023.1796789-1-masahiroy@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 26 Sep 2023 15:09:37 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ARM: fix get_user() broken with veneer To: Masahiro Yamada 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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:10:02 -0700 (PDT) On Tue, 26 Sept 2023 at 14:27, Masahiro Yamada wrote= : > > On Tue, Sep 26, 2023 at 8:37=E2=80=AFPM Ard Biesheuvel = wrote: > > > > 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? > Yes, thanks for rewriting it. I don't think a resend is necessary - please drop this in Russell's patch tracker. Thanks, > > =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.r= st > =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 > > > > > > > -- > Best Regards > Masahiro Yamada