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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4750EC77B6E for ; Thu, 13 Apr 2023 14:57:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C37FB85C77; Thu, 13 Apr 2023 16:56:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="O52AXA8Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 122BC85FBC; Wed, 12 Apr 2023 20:55:51 +0200 (CEST) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3439885FB2 for ; Wed, 12 Apr 2023 20:55:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paskripkin@gmail.com Received: by mail-lj1-x22d.google.com with SMTP id by8so12752265ljb.13 for ; Wed, 12 Apr 2023 11:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681325747; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=j8jJXNP00NtToQb2e8JfmcXYTrM3e1J0Ujv+1l5yQyE=; b=O52AXA8Zinx5wsXIKZecgt1zCly2knDc49DqAQbK3+0nQuhDDp9T+gyVX9XHb0dewH B2yb1L3Bvn8Y/YF2doVSVmWbkGoYsHoGqKW8nl4eow3M0CfFXQ6wv5qiEFoundcvLhIK xxkjtHTgF2URt1v+W16fWPJgaL3vnomiaEtlhejD04ek02XddWxojrmGaaAN6jByUjeQ M83hEEBdVLgTvWGG+1Ttv7c+ZtK39LJW/7XTchplWoCHv4v0WFyeewjjrwngXv4Q9iNc d8O6GBlQbcj2q3ou2ps/4AMIBxX/KGqVVdLLt5/z6XOEHcCqwBRc9rn2oVmUwH7vKPaM KfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681325747; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j8jJXNP00NtToQb2e8JfmcXYTrM3e1J0Ujv+1l5yQyE=; b=gAuYHzN4LOMzsaySFL8QIyLwknR7pAO3KrEb0JslFderAEa6x5n8SNUQMCtjL95Exu B5e+UcrNz9oxjXBKNPixpqan9xUE3GqAGSJp+RUe16fr/yl3aTz5dYUU1VpJTNuIgCkd ZsDGNwnvcgooqkUMqfCi787e9UWOZ6gCTzRzeGlG15c9/3WjO2ZyMG8qSickEJEWd7PO qikURt1wdgyv/XmGU8XfyZmVvifskJo+dmfIHPakbSIgah+cnyqVn8au539Dc8anbt8j 9aWSInz+dlo9fL3DC4fcR/rJOkLZHU9Kzx7S2sm3Osmq04qxq3OgWJJ6/PSLWFhcsMlj F69w== X-Gm-Message-State: AAQBX9d5x4SAr7nzlIjF/907bPsrKLlkFRm24udPE8xq7LhvoN7MKuAY yRGhWvuMm0iLWPsPvqvjtxQ= X-Google-Smtp-Source: AKy350ZQg5YNhXhDfLsTHXoB9bTo+I1jpJ8jpxhZiTDmyr/umyQVcJnXOFD0kjDLptOl/iGzi0A2yA== X-Received: by 2002:a2e:3307:0:b0:2a7:8150:82c1 with SMTP id d7-20020a2e3307000000b002a7815082c1mr1745611ljc.38.1681325747131; Wed, 12 Apr 2023 11:55:47 -0700 (PDT) Received: from fedora.. ([2a00:1370:8180:6b00:a1a8:4887:1af4:637a]) by smtp.gmail.com with ESMTPSA id y24-20020ac255b8000000b004db4c79d845sm3143272lfg.184.2023.04.12.11.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 11:55:46 -0700 (PDT) From: Pavel Skripkin To: sjg@chromium.org, xypron.glpk@gmx.de, u-boot@lists.denx.de Cc: Pavel Skripkin Subject: [PATCH] sandbox: disable tracing before unmapping RAM Date: Wed, 12 Apr 2023 21:55:44 +0300 Message-Id: <20230412185544.150241-1-paskripkin@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 13 Apr 2023 16:56:35 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Currently doing 'reset' command in sandbox with tracing enabled causes SIGSEV ``` Hit any key to stop autoboot: 0 => => => reset resetting ... Segmentation fault (core dumped) ``` Tracing callback uses RAM buffer for storing tracing reports, but state_uninit() function unmaps whole RAM, which causes SIGSEV on umapped memory inside tracing subsystem. Fix it by disabling tracing before unmapping memory Signed-off-by: Pavel Skripkin --- arch/sandbox/cpu/state.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 69da378ab5..d8d5da25b1 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -525,6 +526,9 @@ int state_uninit(void) if (state->jumped_fname) os_unlink(state->jumped_fname); + /* Disable tracing before unmapping RAM */ + trace_set_enabled(0); + os_free(state->state_fdt); os_free(state->ram_buf); memset(state, '\0', sizeof(*state)); -- 2.39.2