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=-21.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 9DBEDC433E0 for ; Thu, 11 Feb 2021 08:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D94664DE2 for ; Thu, 11 Feb 2021 08:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbhBKIP6 (ORCPT ); Thu, 11 Feb 2021 03:15:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:34070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbhBKIPw (ORCPT ); Thu, 11 Feb 2021 03:15:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 03F5D64DE3 for ; Thu, 11 Feb 2021 08:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613031312; bh=r/jjDkP/cNaixfQFqqhPOP8kZqq6pBJzVaqgRc1huUM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NIa8kKfK1zurap6Cj4bNg5OT+f4K1O0d7w2XaZhYrl/ykskJIXSUbkYhbjyFkl/4U 2+WXHR4AnVS4FZVHasPuNX7LswrAtilFLzRW6onTCOnwUMMhfgDoQkZ5tX+wWxgZyy U8a8DTLH9QxCrEEll9oEPqlKNkX5UVxD+ih2q478LCfltEvtYRJrHn0vA/Mk3bLp0z gcYpRA9wFTNlgAtHlXK6eMPY6CcJIT2RWEpePzaxzBojLjEl/NxYTR8VYfcj7pFajM Pi7qSNfEDJh6j6oVCrSf297BIfm7XxDaDp+s7I2IV8vHDMzYDLwqdt+HJM20givpyw 7camNrEu1aECw== Received: by mail-ot1-f51.google.com with SMTP id c16so4445683otp.0 for ; Thu, 11 Feb 2021 00:15:11 -0800 (PST) X-Gm-Message-State: AOAM530Zwi4S/XYCMNiS6ARM2uHYaO8gowiX1jxYKiaVutdJcf8+hVkO JYwslSZbHkgQ8pEmJBylPMqDyb40ycEBD4B12sY= X-Google-Smtp-Source: ABdhPJyQ0MGNmJd3H0wXbZjO7fG51qJ8ZQFZY17m4UPPaEZrGKPBHHOUNzyIIoNjPzi38oUOwKQqhsbaDbVjyw4Q8CU= X-Received: by 2002:a05:6830:11:: with SMTP id c17mr4884725otp.77.1613031311336; Thu, 11 Feb 2021 00:15:11 -0800 (PST) MIME-Version: 1.0 References: <20210211025149.3544593-1-ndesaulniers@google.com> <20210211025149.3544593-2-ndesaulniers@google.com> In-Reply-To: <20210211025149.3544593-2-ndesaulniers@google.com> From: Ard Biesheuvel Date: Thu, 11 Feb 2021 09:15:00 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 1/2] ARM: kprobes: fix UNPREDICTABLE warnings To: Nick Desaulniers Cc: Russell King , Arnd Bergmann , clang-built-linux , Linux ARM , Linux Kernel Mailing List , Nathan Chancellor , Peter Smith , Renato Golin , David Spickett , "kernelci . org bot" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Feb 2021 at 03:52, Nick Desaulniers wrote: > > GNU as warns twice for this file: > Warning: using r15 results in unpredictable behaviour > > via the Arm ARM: > K1.1.1 Overview of the constraints on Armv7 UNPREDICTABLE behaviors > > The term UNPREDICTABLE describes a number of cases where the > architecture has a feature that software must not use. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1271 > Link: https://reviews.llvm.org/D95586 > Reported-by: kernelci.org bot > Suggested-by: Peter Smith > Suggested-by: Renato Golin > Suggested-by: David Spickett > Signed-off-by: Nick Desaulniers Acked-by: Ard Biesheuvel But can we add a bit more context to the commit log, please? It is not obvious to the casual reader why it is OK to emit UNPREDICTABLE opcodes, i.e., that these are selftests that aim to ensure that kprobe never attempts to replace the opcodes in question with a probe, but that they are not actually executed, or expected to occur in real code. > --- > arch/arm/probes/kprobes/test-arm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/probes/kprobes/test-arm.c b/arch/arm/probes/kprobes/test-arm.c > index 977369f1aa48..2543106a203e 100644 > --- a/arch/arm/probes/kprobes/test-arm.c > +++ b/arch/arm/probes/kprobes/test-arm.c > @@ -166,10 +166,10 @@ void kprobe_arm_test_cases(void) > > /* Data-processing with PC as a target and status registers updated */ > TEST_UNSUPPORTED("movs pc, r1") > - TEST_UNSUPPORTED("movs pc, r1, lsl r2") > + TEST_UNSUPPORTED(__inst_arm(0xe1b0f211) " @movs pc, r1, lsl r2") > TEST_UNSUPPORTED("movs pc, #0x10000") > TEST_UNSUPPORTED("adds pc, lr, r1") > - TEST_UNSUPPORTED("adds pc, lr, r1, lsl r2") > + TEST_UNSUPPORTED(__inst_arm(0xe09ef211) " @adds pc, lr, r1, lsl r2") > TEST_UNSUPPORTED("adds pc, lr, #4") > > /* Data-processing with SP as target */ > -- > 2.30.0.478.g8a0d178c01-goog >