Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp902774pxb; Tue, 1 Feb 2022 12:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSJIv3WSkV7nVPgHbTCqrm21nafuUBvwxm3XZiNu4tld2l9Uteal4cHInQUwVtgTM4iM4C X-Received: by 2002:a17:906:d553:: with SMTP id cr19mr21842202ejc.700.1643748462904; Tue, 01 Feb 2022 12:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748462; cv=none; d=google.com; s=arc-20160816; b=0Jo1oZ1e61HoU5Mjfdo9o6gk6sY9Km8L1bLa48rQR7jRyhhgDXKmhvfn297AoXNMNC XY4zlpXGOuIj+d3g7QU5qHjbiLrC166xsjkp44DdgSHgT3SUOvFYbkIqk8sA6WeSGbn9 x7yg30Kabr3WX6bleMhoUohHE6j+R8l9SXHhlZHHbJ3VT4HvjBzh9t0DGpf3Vhjdh6PH MO/74vXygT9onX0hNm283fcy7/kT8FBbMDJQkdNXaeuidF2hVZaJkFEYLjZmBx41ompW 7DL9PmKmCpzGpsariNflr2oqyX13EFHjDEWNH2m6iL4j5K7laS1CFspOi/iX1ST+q7iy Pj+w== 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:from:subject :references:mime-version:message-id:in-reply-to:date:dkim-signature; bh=VrZHx8N8g0O6dwodQoj1XNHskBjb0HhFafa31s7VMgk=; b=co0/4PzhZlDfRlxYnURAYKTnrSlx5Km6PX2aFYIKuqYyV0RNfYNDYYrZTNxq4CFSIY VZHPWxLxsIKvx3v3XN8ndYYVpgAC7X1tqF9C/fyjteUjIkMvfF6XWojdNNR+2B98VLGJ uSZkbysbeL37X/AtF6aWn24o6JNhWma8q+aIbjk5DIn9OcmUp0tBcQ1iqAZGJkbDtPqr 0lCOrzgwh+XlbXveiUesTmxMEfPjL3d83uJ+Vy5nQr3Ehbp9PnIza8Q4oHjJg+YR35K2 x71X6yTJ/1WTlapv29kh0dWiLv7rQOT+Oxp/sZHbjx2fFywBWX0UWOau5WExIlf+8BbB pgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nWvfixk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w2si11500477edc.4.2022.02.01.12.47.17; Tue, 01 Feb 2022 12:47:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nWvfixk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347562AbiAaRzh (ORCPT + 99 others); Mon, 31 Jan 2022 12:55:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231383AbiAaRzg (ORCPT ); Mon, 31 Jan 2022 12:55:36 -0500 Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFBBC06173D for ; Mon, 31 Jan 2022 09:55:35 -0800 (PST) Received: by mail-wm1-x34a.google.com with SMTP id s1-20020a1ca901000000b0034ece94dd8cso10688677wme.5 for ; Mon, 31 Jan 2022 09:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=VrZHx8N8g0O6dwodQoj1XNHskBjb0HhFafa31s7VMgk=; b=nWvfixk4yh5PbGt79V2iCqFfkTKH5zKzS8MudKMCUHNxfzJ4GZQ4rDpJ5LZnx64IfZ 82NcdxxTdh7gbNVTzwrGx2wnF+7hFQBoEg41y98HTzrEGgvdt46ilZZ9pmOnUaPQDpqr eeuTcLIulvK64P6i1YryEEYbWwUZwQ9od/5QIircH4FpZHy9HTEQF/IcTTObip1vvPcd bQzec5cMP3yP01KrIg3SqLrkAYSGz4Hui7eAaDKjGyaJKT1e35L8b7zZNk4gV+wBJ1ru OdKKIA4pqS8D5PuNyTT8LZ4RtMfZ1xup6/C4Ypo/eB3/zLpb97esmkvf1iXzYSAtdxtv k3Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=VrZHx8N8g0O6dwodQoj1XNHskBjb0HhFafa31s7VMgk=; b=iSl1EqJKAA3EzWStExyazjhulhWtjvY5AkoPJ8KrnpWO8KtpPAh8/PfoBQMa/OK/y1 Pr6hyTUhj7sfuhF6AAw3W1uGyhXELcCP0KofPb/vBgbt4rDQCL5AFE2H3J/dYXpK276P j627UYo9C9u7Wx3FgzS9Uj8+SO9sasdZle8bZNAgun2dkZYmUeOUGX+QdrM4niqnHPr9 fLr7nWshmL7K0CZn+ePdpOL9FsmEBSbVsdamaP3ijZdxcqiaAJ8RK78+oOTKGqjHXXgL fZpcr/RUPfdOBsYHn3s0Ujqru4FMSdfGxVIPRM/J3/TfveXSt1m3L/oIi2LfJbK66yns nRFA== X-Gm-Message-State: AOAM531F6eqgpfwisD5+QyKzccoSFd1fHT2vh3wR9p3wBTSJqw7It2b1 QksCXWUEjQ9CFX6lsYbEgbMY+HIDqUQK X-Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:15:13:70c0:d6e6:d591:3fd1]) (user=dvyukov job=sendgmr) by 2002:a5d:518c:: with SMTP id k12mr18236072wrv.169.1643651734018; Mon, 31 Jan 2022 09:55:34 -0800 (PST) Date: Mon, 31 Jan 2022 18:55:26 +0100 In-Reply-To: Message-Id: <20220131175526.1777801-1-dvyukov@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog Subject: Test 73 Sig_trap fails on arm64 From: Dmitry Vyukov To: john.garry@huawei.com, will@kernel.org Cc: acme@kernel.org, elver@google.com, gor@linux.ibm.com, hca@linux.ibm.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mark.rutland@arm.com, sumanthk@linux.ibm.com, svens@linux.ibm.com, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 18/01/2022 12:43, Leo Yan wrote: > > Hi Will, > > Can you kindly check below the question from Leo on this issue? > > You were cc'ed earlier in this thread so should be able to find more > context, if needed. Hi Will, John, I wonder if PSTATE.D flag can be used to resolve this (similar to x86's use of EFLAGS.RF)? I naively tried to do: void OnSigtrap(int sig, siginfo_t* info, void* uctx) { auto& mctx =3D static_cast(uctx)->uc_mcontext; mctx.pstate |=3D PSR_D_BIT; } But then I got a SIGSEGV from kernel. But I wasn't able to track yet what part of the kernel did not like setting of D bit. > Cheers, > John > > > On Tue, Jan 18, 2022 at 12:40:04PM +0100, Marco Elver wrote: > > > > [...] > > > >>> Both Arm and Arm64 platforms cannot support signal handler with > >>> breakpoint, please see the details in [1]. =C2=A0So I think we need > >>> something like below: > >>> > >>> static int test__sigtrap(struct test_suite *test __maybe_unused, int = subtest __maybe_unused) > >>> { > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0... > >>> > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!BP_SIGNAL_IS_SUPPORTED) { > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pr_debu= g("Test not supported on this architecture"); > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return = TEST_SKIP; > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > >>> > >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0... > >>> } > >>> > >>> Since we have defined BP_SIGNAL_IS_SUPPORTED, I think we can reuse it= at > >>> here. > >>> > >>> [1]https://lore.kernel.org/lkml/157169993406.29376.124737710291797557= 67.tip-bot2@tip-bot2/ > >> Does this limitation also exist for address watchpoints? The sigtrap > >> test does not make use of instruction breakpoints, but instead just > >> sets up a watchpoint on access to a data address. > > Yes, after reading the code, the flow for either instrution breakpoint > > or watchpoint both use the single step [1], thus the signal handler wil= l > > take the single step execution and lead to the infinite loop. > > > > I am not the best person to answer this question; @Will, could you > > confirm for this? =C2=A0Thanks! > > > > Leo > > > > [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t= ree/arch/arm64/kernel/hw_breakpoint.c