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=-12.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 AB904C433DF for ; Thu, 30 Jul 2020 21:15:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8700B207F5 for ; Thu, 30 Jul 2020 21:15:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iSeinaQF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730536AbgG3VPA (ORCPT ); Thu, 30 Jul 2020 17:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730281AbgG3VO7 (ORCPT ); Thu, 30 Jul 2020 17:14:59 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275EDC06174A for ; Thu, 30 Jul 2020 14:14:59 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id f24so8891642ejx.6 for ; Thu, 30 Jul 2020 14:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HQQ6RdOfI3qK/AtcGyAa3PPfsZ6PvAzcNLL/uW5Ov+c=; b=iSeinaQFf3yOe2lHxw0CJ8uvvymodnA+gZRBuK4XFslunfBv0lKOpua4/qzmJAeEFf CIhT9MTlKcx429Yqx/9BIvA0klhKjSnvGk84//qFwlrkB9ss82m9nN1DLOaLaapcrVBh KwI/PLMaPPLuiVBdfpgbc6+Q6yzAILIrEWmSOzbfKHx359OcZL2Ra3+hiznU8ilKAdgG YM3x9kcYKXXxov8pSZBJMUeEQ2qZIy648K1J3KfS1xgw1u2pwO3Wr8gjFMa+X2vSEiZ+ yNar+F+DxEXNUGQoQlvdbdB6KQ/xGNWe7kHQq4J3/QP3sB0jL/wbrhD+H/8BX/pHIxDw xrHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HQQ6RdOfI3qK/AtcGyAa3PPfsZ6PvAzcNLL/uW5Ov+c=; b=L+yOEkNzqe5jEuGcYvDAO7ZTclrxMVpeL/uqyB8PTkYiK1dPkaTKy19SnpiOprcc6e qDcOXOzinZnep2Z07ZFrssRUF/ZcgkOEe8oVUHgqTwhF0Z189Jst9qwrEWtrmZuNUP5N 6jK5Qrbx0Xq5pIqV6e2tqnbnzr0yT82Td19Z6YzaXtM8b1+oKDslvI7qC6zQvvvNe5no O7opbxrptj7ONvNyYmTpexHsAalk8DTo9x41dtka5iRpIbqI1IFLsAovMpCR4yer+Y5s oOvib1xu0qCxAEHHogzI/9HYdZTTfE+9aKDZJESpOrvFxXYv1gwCIEG643FuC631eOJm OImw== X-Gm-Message-State: AOAM5300i/4leF9iscWE785/xfPw94Jk9tzyBsiF/v1Pc/6mpxCsZ5C0 /YKcwwSdPV3Blv5JOwwcTfq3aA== X-Google-Smtp-Source: ABdhPJzlHh02QVVAFLKTB+xoRHb3mqAraUbK6zYudTHxIdHXY8kSsZkO1Rf8FHPFvQ+mk1u0vH6A8A== X-Received: by 2002:a17:906:fb07:: with SMTP id lz7mr991136ejb.49.1596143697686; Thu, 30 Jul 2020 14:14:57 -0700 (PDT) Received: from lophozonia ([2001:1715:4e26:a7e0:f1b0:45a6:cd09:bcd0]) by smtp.gmail.com with ESMTPSA id w20sm7569128eds.21.2020.07.30.14.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2020 14:14:57 -0700 (PDT) Date: Thu, 30 Jul 2020 23:14:53 +0200 From: Jean-Philippe Brucker To: Daniel Borkmann Cc: Qian Cai , linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, songliubraving@fb.com, andriin@fb.com, catalin.marinas@arm.com, john.fastabend@gmail.com, ast@kernel.org, zlim.lnx@gmail.com, kpsingh@chromium.org, yhs@fb.com, will@kernel.org, kafai@fb.com, sfr@canb.auug.org.au, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables Message-ID: <20200730211453.GA79372@lophozonia> References: <20200728152122.1292756-1-jean-philippe@linaro.org> <20200728152122.1292756-2-jean-philippe@linaro.org> <20200730122855.GA3773@lca.pw> <20200730142213.GB1529030@myrica> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 30, 2020 at 09:47:39PM +0200, Daniel Borkmann wrote: > On 7/30/20 4:22 PM, Jean-Philippe Brucker wrote: > > On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: > > > On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote: > > > > When a tracing BPF program attempts to read memory without using the > > > > bpf_probe_read() helper, the verifier marks the load instruction with > > > > the BPF_PROBE_MEM flag. Since the arm64 JIT does not currently recognize > > > > this flag it falls back to the interpreter. > > > > > > > > Add support for BPF_PROBE_MEM, by appending an exception table to the > > > > BPF program. If the load instruction causes a data abort, the fixup > > > > infrastructure finds the exception table and fixes up the fault, by > > > > clearing the destination register and jumping over the faulting > > > > instruction. > > > > > > > > To keep the compact exception table entry format, inspect the pc in > > > > fixup_exception(). A more generic solution would add a "handler" field > > > > to the table entry, like on x86 and s390. > > > > > > > > Signed-off-by: Jean-Philippe Brucker > > > > > > This will fail to compile on arm64, > > > > > > https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config > > > > > > arch/arm64/mm/extable.o: In function `fixup_exception': > > > arch/arm64/mm/extable.c:19: undefined reference to `arm64_bpf_fixup_exception' > > > > Thanks for the report, I attached a fix. Daniel, can I squash it and > > resend as v2 or is it too late? > > If you want I can squash your attached snippet into the original patch of > yours. If you want to send a v2 that is fine as well of course. Let me know. Yes please squash it into the original patch, sorry for the mess Thanks, Jean 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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,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 8F05BC433E0 for ; Thu, 30 Jul 2020 21:16:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 555E8207F5 for ; Thu, 30 Jul 2020 21:16:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NInHWZDO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iSeinaQF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 555E8207F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ma/UP/uE3cIyNyWmAQiZjGVNJIOOJPnrpObNdhlyScU=; b=NInHWZDOIdA7vntfS5BS7xg6w h7qLiVIoJUKtCzjkrKFFMYvYTXonP2i56SH0/MpoR0RvrEwMGZjBrd4Rx06qzRMhkkhx4ih9n4FfN Hf6c0oZKra8/K/kTpnvUaSW9cfHhSrdUFjRAlphniDqNGq4pSUlVej47+RoVj7P1+ClMnHDJ2Ycej uWNJ2c2fia2Zcalo5OGBd7jzynR5GEXERnpQ8lGmUMxrjM6We9sKCfSogmkdOtE14LyHWdF/scU41 WQQYfAv3H5hLB79+m4RvKBD5H5oocw42XCR/fpLU+l+x152sHazGOqKGsBr9eLoBDyAp+3v6tN8jf UlNhxZrxQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1FtH-0007kQ-FY; Thu, 30 Jul 2020 21:15:03 +0000 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1FtE-0007fq-6o for linux-arm-kernel@lists.infradead.org; Thu, 30 Jul 2020 21:15:01 +0000 Received: by mail-ej1-x642.google.com with SMTP id jp10so2811775ejb.0 for ; Thu, 30 Jul 2020 14:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HQQ6RdOfI3qK/AtcGyAa3PPfsZ6PvAzcNLL/uW5Ov+c=; b=iSeinaQFf3yOe2lHxw0CJ8uvvymodnA+gZRBuK4XFslunfBv0lKOpua4/qzmJAeEFf CIhT9MTlKcx429Yqx/9BIvA0klhKjSnvGk84//qFwlrkB9ss82m9nN1DLOaLaapcrVBh KwI/PLMaPPLuiVBdfpgbc6+Q6yzAILIrEWmSOzbfKHx359OcZL2Ra3+hiznU8ilKAdgG YM3x9kcYKXXxov8pSZBJMUeEQ2qZIy648K1J3KfS1xgw1u2pwO3Wr8gjFMa+X2vSEiZ+ yNar+F+DxEXNUGQoQlvdbdB6KQ/xGNWe7kHQq4J3/QP3sB0jL/wbrhD+H/8BX/pHIxDw xrHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HQQ6RdOfI3qK/AtcGyAa3PPfsZ6PvAzcNLL/uW5Ov+c=; b=sOPCEflhc55gm/slXuApQsFXgnOOq5gDAqZkGljE8jRN36BxpJ7LyLAOt4BhvVRnzs S+jA1ycchf3pQakS0ZBMJFpazG6cuI8zfGKfh/GL+ApwDlNzK/BQnzunsI3PBtL/oNJE W4W6lAsGf/C2qze1ngO95JcLXx0dJ77iPwjzMhuqzJtmHURPA8DDlFnsIp2SzjNsy4+j ZC12BMi+dYubhkZibNwraYaD+cAv1oPmc3tBpy2ngVRKc/PAHldGUQA3j/abCWuQ9l+V FH/GiEPEl/ZpNOJ0PScLUfCYFA+/xT5XnJVgcZIotq8yuIC6FxXx7U/skyh+j/58Z01d aDLw== X-Gm-Message-State: AOAM533K7ATj4xU3CS5BoFbywXfCo3ELzCMYDUTxmmsqisi4ehBeJp0u tl1cBJbYhhQ/ZLoaD3kIOcyiGg== X-Google-Smtp-Source: ABdhPJzlHh02QVVAFLKTB+xoRHb3mqAraUbK6zYudTHxIdHXY8kSsZkO1Rf8FHPFvQ+mk1u0vH6A8A== X-Received: by 2002:a17:906:fb07:: with SMTP id lz7mr991136ejb.49.1596143697686; Thu, 30 Jul 2020 14:14:57 -0700 (PDT) Received: from lophozonia ([2001:1715:4e26:a7e0:f1b0:45a6:cd09:bcd0]) by smtp.gmail.com with ESMTPSA id w20sm7569128eds.21.2020.07.30.14.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2020 14:14:57 -0700 (PDT) Date: Thu, 30 Jul 2020 23:14:53 +0200 From: Jean-Philippe Brucker To: Daniel Borkmann Subject: Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables Message-ID: <20200730211453.GA79372@lophozonia> References: <20200728152122.1292756-1-jean-philippe@linaro.org> <20200728152122.1292756-2-jean-philippe@linaro.org> <20200730122855.GA3773@lca.pw> <20200730142213.GB1529030@myrica> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200730_171500_333301_E28C2C8C X-CRM114-Status: GOOD ( 24.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sfr@canb.auug.org.au, songliubraving@fb.com, will@kernel.org, catalin.marinas@arm.com, john.fastabend@gmail.com, ast@kernel.org, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, Qian Cai , zlim.lnx@gmail.com, kpsingh@chromium.org, yhs@fb.com, bpf@vger.kernel.org, andriin@fb.com, kafai@fb.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 30, 2020 at 09:47:39PM +0200, Daniel Borkmann wrote: > On 7/30/20 4:22 PM, Jean-Philippe Brucker wrote: > > On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: > > > On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote: > > > > When a tracing BPF program attempts to read memory without using the > > > > bpf_probe_read() helper, the verifier marks the load instruction with > > > > the BPF_PROBE_MEM flag. Since the arm64 JIT does not currently recognize > > > > this flag it falls back to the interpreter. > > > > > > > > Add support for BPF_PROBE_MEM, by appending an exception table to the > > > > BPF program. If the load instruction causes a data abort, the fixup > > > > infrastructure finds the exception table and fixes up the fault, by > > > > clearing the destination register and jumping over the faulting > > > > instruction. > > > > > > > > To keep the compact exception table entry format, inspect the pc in > > > > fixup_exception(). A more generic solution would add a "handler" field > > > > to the table entry, like on x86 and s390. > > > > > > > > Signed-off-by: Jean-Philippe Brucker > > > > > > This will fail to compile on arm64, > > > > > > https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config > > > > > > arch/arm64/mm/extable.o: In function `fixup_exception': > > > arch/arm64/mm/extable.c:19: undefined reference to `arm64_bpf_fixup_exception' > > > > Thanks for the report, I attached a fix. Daniel, can I squash it and > > resend as v2 or is it too late? > > If you want I can squash your attached snippet into the original patch of > yours. If you want to send a v2 that is fine as well of course. Let me know. Yes please squash it into the original patch, sorry for the mess Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel