From patchwork Tue Nov 5 15:03:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 840813 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp35935wru; Tue, 5 Nov 2024 07:05:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW7W5ofcCX76vi2ETrxmq65aoI4CjOq5tSIB802a5ZYBhB43zcH1iKty7UQcD7dLFjj2hAKJA==@linaro.org X-Google-Smtp-Source: AGHT+IGaKMiXPbdKMvp76H00Vv1TbE5hsXAuYaknk5ARLnp9ixid8CxjcMuxX1QE4IP0lzSEvlCc X-Received: by 2002:a05:620a:24c2:b0:7b1:3e41:8495 with SMTP id af79cd13be357-7b2fb9aac8dmr2411255285a.48.1730819104761; Tue, 05 Nov 2024 07:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730819104; cv=none; d=google.com; s=arc-20240605; b=Bx4HtBgKLIvC0WtoW8qo2i6YfEpMb8pnaYO7aycyylVFaEi8RuS/pzJSLnkSj5MQoI buNA3DRwsze0JRcPy2Gb3Wt8YLJdiTl9MfJJrXwAbkWyWcq8+jRDeJiBi+T54UX/F5hF 2CBbG8y9e3Gz++Kw0liQvVa+WD0w9q8jlXeqSSmHROVr6eOfpB06xW+5KG17OqPw6k8f OAnYhtGOPRuF33WVO2ol025oaIDE+glO+uhEw8jPo3FvCoX7QcpLB/nKqqV7P3znMxAy xscpdOeO97Y7LQacaCSY7aItDf6XEaoQoLOpAMMs1+q7kuuG3DcsYpr9HQLs/aF4GUOC 1TaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cYHCRBRNBPe/0uEKc6Z5yhuwEHOYnf7f6KwnFwUGwXc=; fh=m3bIYSMZqCABEJVkIKLKf3tNf8TH8EKhZ9yqNwsZqDo=; b=X93E3Eur2eGgZEzgy9OWVufVdGD/dgJQL/m2eHGW08pcVjeKqZdtRRZHjCnlVTcK9Y wAYDw1lgUSuDsDCFluNpTOsaex6JIK9R+U8AGT9cNm6EiF77m32jhF84lyU8KMm5Yxnd ZMp24t0ZdP7A0iQW9qDziwZDJnd2Tf4mXWrzGcr8icG1g5pfAN8ZB4rgHnWwi1ZN4BRR WdAyyj3pzZiQ8e01jHzKj63ZVkVUJhUSuV4BKP15YqQklQQ6HTE3I7CQw8AjoogqP+Hl 0oiTLaBcWae5A2ZTpGPqk8x9MryuYYZe63sWeqiNJrWrReGy4UgtCruHW2U/Me826zpp QbZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hesJf0YH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b2f3ab145dsi1354146885a.577.2024.11.05.07.05.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 07:05:04 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hesJf0YH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8L6N-0000rX-Br; Tue, 05 Nov 2024 10:04:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8L64-0000qH-Ns for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:04:00 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8L61-0000rx-VP for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:03:55 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539e63c8678so6341206e87.0 for ; Tue, 05 Nov 2024 07:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730819032; x=1731423832; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cYHCRBRNBPe/0uEKc6Z5yhuwEHOYnf7f6KwnFwUGwXc=; b=hesJf0YHdpm2v5OKr3xFaOTvd4cTajDt/iMA7AS0XNsKnT/DS6HCb5TO97ui1Li3pJ kedEgvzwxSZ3oRz9hRLPXUqthYTG5JlS26dNwrZ2zEKh/UcjIx8rbfhIkA1uBYa5c/+N FLD4r89JO+Z1NK7pdNh+Ugjjl5QgU2Xfaw1BRRobVkHCAEgJcaC/AzQdO6aMtzHvMiQG wanLw5Rq1Y4cT0DOdqrH4UaJdbdtAFtbNgnH49GB1ADL97fV3b7g9ZMSrucSvUwk6R6C 4ONaNf6LZm1DrT8O1e88cyCj2macncv99mSd69hB6xBmzZy7f1Sg7sLnG/XtziSQLoGe m3ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730819032; x=1731423832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cYHCRBRNBPe/0uEKc6Z5yhuwEHOYnf7f6KwnFwUGwXc=; b=NB4B1JStJsvTdDvNzn6+j6tNebk430cCMDcAWZBdR2YKqg4bU0fW+15U0E0e61uIqA X5ZZVvypDkGP5jUpF20ezExlzkDcxIvpBBKwooib5SxaNk822HQVTshgrRJ6ezwXokx9 KkZKk1uaUSEzL5bOOHsQM4NePNO4jF3f6tPYmIAti34PZA+PQ9oL/pSCNBGLrUUMBusL wlSRjxIX8P7O47WcznVinqNRPqnlgYEFHtt5sR4pgCuaJy/CSMEpCz7zgaR/squIi7oT LqUHB2YSyS6lvOWHkwhElWtMHzJN0VcCXUmdIjwl7384Wz5Ieof9fDLxsBPD5jJjLQNr 1eKw== X-Gm-Message-State: AOJu0YzpkSKdq4+tWzr0vXF00io7kCbXC33N4FNUYDs1HeoYgS19Q7BE Yq6WiuBfHuTszYfzCbJdkMvy3MKY7wXagsdpPdWRVAlgzDFxDBZEm5Jg2lRdThL9JEUUxuyiLCU 5HU8= X-Received: by 2002:a05:6512:2243:b0:53b:1f7a:9bfd with SMTP id 2adb3069b0e04-53d65e17196mr8140531e87.52.1730819031889; Tue, 05 Nov 2024 07:03:51 -0800 (PST) Received: from stoup.. ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9ca6f8sm221301855e9.39.2024.11.05.07.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 07:03:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 1/4] tests/tcg: Replace -mpower8-vector with -mcpu=power8 Date: Tue, 5 Nov 2024 15:03:45 +0000 Message-ID: <20241105150348.446982-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241105150348.446982-1-richard.henderson@linaro.org> References: <20241105150348.446982-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x132.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich [1] deprecated -mpower8-vector, resulting in: powerpc64-linux-gnu-gcc: warning: switch '-mpower8-vector' is no longer supported qemu/tests/tcg/ppc64/vsx_f2i_nan.c:4:15: error: expected ';' before 'float' 4 | typedef vector float vsx_float32_vec_t; | ^~~~~~ Use -mcpu=power8 instead. In order to properly verify that this works, one needs a big-endian (the minimum supported CPU for 64-bit little-endian is power8 anyway) GCC configured with --enable-checking (see GCC commit e154242724b0 ("[RS6000] Don't pass -many to the assembler"). [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109987 Signed-off-by: Ilya Leoshkevich Acked-by: Alex Bennée Reviewed-by: Richard Henderson Message-ID: <20241023131250.48510-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/ppc64/Makefile.target | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target index 1940886c73..0d058b2600 100644 --- a/tests/tcg/ppc64/Makefile.target +++ b/tests/tcg/ppc64/Makefile.target @@ -6,7 +6,7 @@ VPATH += $(SRC_PATH)/tests/tcg/ppc64 config-cc.mak: Makefile $(quiet-@)( \ - $(call cc-option,-mpower8-vector, CROSS_CC_HAS_POWER8_VECTOR); \ + $(call cc-option,-mcpu=power8, CROSS_CC_HAS_CPU_POWER8); \ $(call cc-option,-mpower10, CROSS_CC_HAS_POWER10)) 3> config-cc.mak -include config-cc.mak @@ -23,15 +23,15 @@ run-threadcount: threadcount run-plugin-threadcount-with-%: $(call skip-test, $<, "BROKEN (flaky with clang) ") -ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) +ifneq ($(CROSS_CC_HAS_CPU_POWER8),) PPC64_TESTS=bcdsub non_signalling_xscv endif -$(PPC64_TESTS): CFLAGS += -mpower8-vector +$(PPC64_TESTS): CFLAGS += -mcpu=power8 -ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) +ifneq ($(CROSS_CC_HAS_CPU_POWER8),) PPC64_TESTS += vsx_f2i_nan endif -vsx_f2i_nan: CFLAGS += -mpower8-vector -I$(SRC_PATH)/include +vsx_f2i_nan: CFLAGS += -mcpu=power8 -I$(SRC_PATH)/include PPC64_TESTS += mtfsf PPC64_TESTS += mffsce From patchwork Tue Nov 5 15:03:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 840811 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp35842wru; Tue, 5 Nov 2024 07:04:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUF8oSrj52mAhcWZC1YLWXVSc0vXifTxrjtllvGx6NqsNM7EAkG1eHBu3yBfxzg4OmfQWD/rw==@linaro.org X-Google-Smtp-Source: AGHT+IFih9XfxrPiZrfz/oc8MAH1K1cGGf8tIqsTA55xLz4DYIVLmB4CVTDuUEIDa7/8gMi1hvRo X-Received: by 2002:a05:600c:354f:b0:431:518a:6826 with SMTP id 5b1f17b1804b1-43283255a71mr176000085e9.19.1730819095383; Tue, 05 Nov 2024 07:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730819095; cv=none; d=google.com; s=arc-20240605; b=DqvR7+JWorDC17hWO7wMPLAo63gsQxATKncOymZGXDFAFaRBeaSWgluj9dENYoFXCx 8fnZaD/2xrNMe6nXwCSST0DiVERPZ2KoxmQ3OS7UkGpYYdvHAOIdP0uMSJdUHNW9hjPk gE0gpfje/usBH53xakoDo0Q0pa2rnKKi4XN/XCtsTCaNzl1S6dGXxXBbGoik1fpQMB+t RkyyNNv5AVvY92gt4bpAQW+4DFHhMeRRVUVB/jPRnpo+N/5DA5zZlNObGuOqUOANquT5 XhYejjC8svD54Nh8AzdsGBTrHRu3NuqDVScpu0ibhMJrCAt8sn/YL02sc5TFlhMHX0D2 HRgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JKJ6rUlZAefITLcvceunRCf84be+5Vcrxe5vzgoY/DE=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=aXRodzNy8lLbjHc945vX3F4/nBIht8bqEDKUIdvhI9b9kJDucinMho1l9K0ON7ist8 gb5dWcGt566vhDBW2rtZVAm8fa3Rf9MSRJOpUpAZJdTnGLTJBa6imRMANaeMO+J88JSk 3+qLO+iyy8nQZKQeMzPJIS+oX3gFH1cCXEL6yv1mq5SwMrfAXEcYeHGg/Ix1Wn9h2APg mlKRdI5rH1lOgL211tww+hu4yg0fb2BIHEgiVhKm9W6/V/cR4xxGOtu+QWGFMYgADOXJ 7kWQx/n4xixkqcHrbu5+g5Uh27fjYA0G8q5Uz8TjvqWxLN8d76UTSHCPdGBvAJTuyCyb R0fg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FzTYufAP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 5b1f17b1804b1-431bd9cd9e4si93794345e9.192.2024.11.05.07.04.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 07:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FzTYufAP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8L6O-0000ri-PB; Tue, 05 Nov 2024 10:04:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8L66-0000qL-Nc for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:04:01 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8L64-0000sC-FU for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:03:58 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4316cce103dso65843845e9.3 for ; Tue, 05 Nov 2024 07:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730819034; x=1731423834; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JKJ6rUlZAefITLcvceunRCf84be+5Vcrxe5vzgoY/DE=; b=FzTYufAPAXDPdveTGMTBjKjl7ssr8FaAE1NP4MOobOXygqDMcHCm9gn3SVtNhUgZOj SwiDEbNjCBhwslpHXn5d7KF4K4L5g0rXgrQErKwHmhCgSWPTu2Gx4hZIAIHcRI1d7RFU M8S3mmFRr9qjaHMTG2XJJTyprqp97Fdyg1KXLedIsK/1LCLZzXN5W+szUYTwpzPSnFC7 fV84gKVyXqTXxPAuBEK6xm6FUs7S5Ks1mJKP2ZCIgm5go+819WFJFBlZ6P7I0k52NT2B Z6dvBNmJXATbMOJXBJHa+pwQgCA54mJ5Vh3pTBzENZsXyUcQ2eTj8Umw0bzSWbdLzfcJ Hkmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730819034; x=1731423834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JKJ6rUlZAefITLcvceunRCf84be+5Vcrxe5vzgoY/DE=; b=Wni1ygC1Q7Hods9XkATlStFGSZy/+0a0LzgKQ82Gdip0Lsjo341ryC5BIzLu2x3C70 2d/ks29eyafX6aqhvN7Va87ccdeIu19nNNL8sDhCL1l8Pm4DFvpHprm21QLEL2B1XmvC jW9R7/XYuhJbd1n1PLALU3Ty+8/SDU3W+SqW8fbZ8VsSPxxeTzNaEcndqNOSzo7DJLJQ L/d0o3qpk8fhYVldEGokLEKzGAkkOR4FBAaW3DYftDH4Wo/QI+pN/So1FFzd2qHXMjYc Ll7/YxT+7EzdacwysVg59tGZaKEwPd5/3oK9n6nu7kP/xm2mkouGe4Y0Vmq4DHpNV/Ye mUGA== X-Gm-Message-State: AOJu0YxwfSW46im6Ub+r5NDFCU89y59Eo1Cw+C3Vy3aUgfY7ZdS5YGNU mLcPD/LextA7LYty8RbX9lHY6x33UxIfK1nXV4w2utEaqWJ5qQEUISkTiA5Jokcvh0kA9wyNkx+ 9lxI= X-Received: by 2002:a05:600c:1c9c:b0:42c:a8cb:6a5a with SMTP id 5b1f17b1804b1-43283255a50mr163773155e9.15.1730819033875; Tue, 05 Nov 2024 07:03:53 -0800 (PST) Received: from stoup.. ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9ca6f8sm221301855e9.39.2024.11.05.07.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 07:03:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 2/4] linux-user: Fix GDB complaining about system-supplied DSO string table index Date: Tue, 5 Nov 2024 15:03:46 +0000 Message-ID: <20241105150348.446982-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241105150348.446982-1-richard.henderson@linaro.org> References: <20241105150348.446982-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich When debugging qemu-user processes using gdbstub, the following warning appears every time: warning: BFD: warning: system-supplied DSO at 0x7f8253cc3000 has a corrupt string table index The reason is that QEMU does not map the VDSO's section headers. The VDSO's ELF header's e_shoff points to zeros, which GDB fails to parse. The difference with the kernel's VDSO is that the latter is mapped as a blob, ignoring program headers - which also don't cover the section table. QEMU, on the other hand, loads it as an ELF file. There appears to be no way to place section headers inside a section, and, therefore, no way to refer to them from a linker script. Also, ld hardcodes section headers to be non-loadable, see _bfd_elf_assign_file_positions_for_non_load(). In theory ld could be enhanced by implementing an "SHDRS" keyword in addition to the existing "FILEHDR" and "PHDRS". There are multiple ways to resolve the issue: - Copy VDSO as a blob in load_elf_vdso(). This would require creating specialized loader logic, that duplicates parts of load_elf_image(). - Fix up VDSO's PHDR size in load_elf_vdso(). This would require either duplicating the parsing logic, or adding an ugly parameter to load_elf_image(). - Fix up VDSO's PHDR size in gen-vdso. This is the simplest solution, so do it. There are two tricky parts: - Byte-swaps need to be done either on local copies, or in-place and then reverted in the end. To preserve the existing code structure, do the former for Sym and Dyn, and the latter for Ehdr, Phdr, and Shdr. - There must be no .bss, which is already the case - but having an explicit check is helpful to ensure correctness. To verify this change, I diffed the on-disk and the loaded VDSOs; the result does not show anything unusual, except for what seems to be an existing oversight (which should probably be fixed separately): │ Symbol table '.dynsym' contains 8 entries: │ Num: Value Size Type Bind Vis Ndx Name │ - 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND │ - 6: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.29 │ + 0: 00007f61075bf000 0 NOTYPE LOCAL DEFAULT UND │ + 6: 00007f61075bf000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.29 Fixes: 2fa536d10797 ("linux-user: Add gen-vdso tool") Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Message-ID: <20241023202850.55211-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/gen-vdso.c | 40 +++++++------- linux-user/gen-vdso-elfn.c.inc | 98 +++++++++++++++++++++++----------- 2 files changed, 87 insertions(+), 51 deletions(-) diff --git a/linux-user/gen-vdso.c b/linux-user/gen-vdso.c index 31e333be80..721f38d5a3 100644 --- a/linux-user/gen-vdso.c +++ b/linux-user/gen-vdso.c @@ -131,23 +131,6 @@ int main(int argc, char **argv) } fclose(inf); - /* - * Write out the vdso image now, before we make local changes. - */ - - fprintf(outf, - "/* Automatically generated from linux-user/gen-vdso.c. */\n" - "\n" - "static const uint8_t %s_image[] = {", - prefix); - for (long i = 0; i < total_len; ++i) { - if (i % 12 == 0) { - fputs("\n ", outf); - } - fprintf(outf, " 0x%02x,", buf[i]); - } - fprintf(outf, "\n};\n\n"); - /* * Identify which elf flavor we're processing. * The first 16 bytes of the file are e_ident. @@ -179,14 +162,17 @@ int main(int argc, char **argv) * Output relocation addresses as we go. */ - fprintf(outf, "static const unsigned %s_relocs[] = {\n", prefix); + fprintf(outf, + "/* Automatically generated by linux-user/gen-vdso.c. */\n" + "\n" + "static const unsigned %s_relocs[] = {\n", prefix); switch (buf[EI_CLASS]) { case ELFCLASS32: - elf32_process(outf, buf, need_bswap); + elf32_process(outf, buf, total_len, need_bswap); break; case ELFCLASS64: - elf64_process(outf, buf, need_bswap); + elf64_process(outf, buf, total_len, need_bswap); break; default: fprintf(stderr, "%s: invalid elf EI_CLASS (%u)\n", @@ -196,6 +182,20 @@ int main(int argc, char **argv) fprintf(outf, "};\n\n"); /* end vdso_relocs. */ + /* + * Write out the vdso image now, after we made local changes. + */ + fprintf(outf, + "static const uint8_t %s_image[] = {", + prefix); + for (long i = 0; i < total_len; ++i) { + if (i % 12 == 0) { + fputs("\n ", outf); + } + fprintf(outf, " 0x%02x,", buf[i]); + } + fprintf(outf, "\n};\n\n"); + fprintf(outf, "static const VdsoImageInfo %s_image_info = {\n", prefix); fprintf(outf, " .image = %s_image,\n", prefix); fprintf(outf, " .relocs = %s_relocs,\n", prefix); diff --git a/linux-user/gen-vdso-elfn.c.inc b/linux-user/gen-vdso-elfn.c.inc index 95856eb839..b47019e136 100644 --- a/linux-user/gen-vdso-elfn.c.inc +++ b/linux-user/gen-vdso-elfn.c.inc @@ -68,28 +68,45 @@ static void elfN(search_symtab)(ElfN(Shdr) *shdr, unsigned sym_idx, void *buf, bool need_bswap) { unsigned str_idx = shdr[sym_idx].sh_link; - ElfN(Sym) *sym = buf + shdr[sym_idx].sh_offset; - unsigned sym_n = shdr[sym_idx].sh_size / sizeof(*sym); + ElfN(Sym) *target_sym = buf + shdr[sym_idx].sh_offset; + unsigned sym_n = shdr[sym_idx].sh_size / sizeof(*target_sym); const char *str = buf + shdr[str_idx].sh_offset; for (unsigned i = 0; i < sym_n; ++i) { const char *name; + ElfN(Sym) sym; + memcpy(&sym, &target_sym[i], sizeof(sym)); if (need_bswap) { - elfN(bswap_sym)(sym + i); + elfN(bswap_sym)(&sym); } - name = str + sym[i].st_name; + name = str + sym.st_name; if (sigreturn_sym && strcmp(sigreturn_sym, name) == 0) { - sigreturn_addr = sym[i].st_value; + sigreturn_addr = sym.st_value; } if (rt_sigreturn_sym && strcmp(rt_sigreturn_sym, name) == 0) { - rt_sigreturn_addr = sym[i].st_value; + rt_sigreturn_addr = sym.st_value; } } } -static void elfN(process)(FILE *outf, void *buf, bool need_bswap) +static void elfN(bswap_ps_hdrs)(ElfN(Ehdr) *ehdr) +{ + ElfN(Phdr) *phdr = (void *)ehdr + ehdr->e_phoff; + ElfN(Shdr) *shdr = (void *)ehdr + ehdr->e_shoff; + ElfN(Half) i; + + for (i = 0; i < ehdr->e_phnum; ++i) { + elfN(bswap_phdr)(&phdr[i]); + } + + for (i = 0; i < ehdr->e_shnum; ++i) { + elfN(bswap_shdr)(&shdr[i]); + } +} + +static void elfN(process)(FILE *outf, void *buf, long len, bool need_bswap) { ElfN(Ehdr) *ehdr = buf; ElfN(Phdr) *phdr; @@ -103,24 +120,14 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) int errors = 0; if (need_bswap) { - elfN(bswap_ehdr)(ehdr); + elfN(bswap_ehdr)(buf); + elfN(bswap_ps_hdrs)(buf); } phnum = ehdr->e_phnum; phdr = buf + ehdr->e_phoff; - if (need_bswap) { - for (unsigned i = 0; i < phnum; ++i) { - elfN(bswap_phdr)(phdr + i); - } - } - shnum = ehdr->e_shnum; shdr = buf + ehdr->e_shoff; - if (need_bswap) { - for (unsigned i = 0; i < shnum; ++i) { - elfN(bswap_shdr)(shdr + i); - } - } for (unsigned i = 0; i < shnum; ++i) { switch (shdr[i].sh_type) { case SHT_SYMTAB: @@ -154,7 +161,24 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) fprintf(stderr, "LOAD segment not loaded at address 0\n"); errors++; } - first_segsz = phdr[i].p_filesz; + /* + * Extend the program header to cover the entire VDSO, so that + * load_elf_vdso() loads everything, including section headers. + * + * Require that there is no .bss, since it would break this + * approach. + */ + if (phdr[i].p_filesz != phdr[i].p_memsz) { + fprintf(stderr, "LOAD segment's filesz and memsz differ\n"); + errors++; + } + if (phdr[i].p_filesz > len) { + fprintf(stderr, "LOAD segment is larger than the whole VDSO\n"); + errors++; + } + phdr[i].p_filesz = len; + phdr[i].p_memsz = len; + first_segsz = len; if (first_segsz < ehdr->e_phoff + phnum * sizeof(*phdr)) { fprintf(stderr, "LOAD segment does not cover PHDRs\n"); errors++; @@ -197,17 +221,24 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) output_reloc(outf, buf, &phdr[i].p_paddr); } + /* Relocate the section headers. */ + for (unsigned i = 0; i < shnum; ++i) { + output_reloc(outf, buf, &shdr[i].sh_addr); + } + /* Relocate the DYNAMIC entries. */ if (dynamic_addr) { - ElfN(Dyn) *dyn = buf + dynamic_ofs; - __typeof(dyn->d_tag) tag; + ElfN(Dyn) *target_dyn = buf + dynamic_ofs; + __typeof(((ElfN(Dyn) *)target_dyn)->d_tag) tag; do { + ElfN(Dyn) dyn; + memcpy(&dyn, target_dyn, sizeof(dyn)); if (need_bswap) { - elfN(bswap_dyn)(dyn); + elfN(bswap_dyn)(&dyn); } - tag = dyn->d_tag; + tag = dyn.d_tag; switch (tag) { case DT_HASH: @@ -218,7 +249,7 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) case DT_PLTGOT: case DT_ADDRRNGLO ... DT_ADDRRNGHI: /* These entries store an address in the entry. */ - output_reloc(outf, buf, &dyn->d_un.d_val); + output_reloc(outf, buf, &target_dyn->d_un.d_val); break; case DT_NULL: @@ -235,7 +266,7 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) break; case DT_SYMENT: - if (dyn->d_un.d_val != sizeof(ElfN(Sym))) { + if (dyn.d_un.d_val != sizeof(ElfN(Sym))) { fprintf(stderr, "VDSO has incorrect dynamic symbol size\n"); errors++; } @@ -251,7 +282,7 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) * ??? The RISC-V toolchain will emit these even when there * are no relocations. Validate zeros. */ - if (dyn->d_un.d_val != 0) { + if (dyn.d_un.d_val != 0) { fprintf(stderr, "VDSO has dynamic relocations\n"); errors++; } @@ -287,7 +318,7 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) errors++; break; } - dyn++; + target_dyn++; } while (tag != DT_NULL); if (errors) { exit(EXIT_FAILURE); @@ -296,11 +327,11 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) /* Relocate the dynamic symbol table. */ if (dynsym_idx) { - ElfN(Sym) *sym = buf + shdr[dynsym_idx].sh_offset; - unsigned sym_n = shdr[dynsym_idx].sh_size / sizeof(*sym); + ElfN(Sym) *target_sym = buf + shdr[dynsym_idx].sh_offset; + unsigned sym_n = shdr[dynsym_idx].sh_size / sizeof(*target_sym); for (unsigned i = 0; i < sym_n; ++i) { - output_reloc(outf, buf, &sym[i].st_value); + output_reloc(outf, buf, &target_sym[i].st_value); } } @@ -311,4 +342,9 @@ static void elfN(process)(FILE *outf, void *buf, bool need_bswap) if (symtab_idx) { elfN(search_symtab)(shdr, symtab_idx, buf, need_bswap); } + + if (need_bswap) { + elfN(bswap_ps_hdrs)(buf); + elfN(bswap_ehdr)(buf); + } } From patchwork Tue Nov 5 15:03:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 840815 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp36493wru; Tue, 5 Nov 2024 07:05:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW3Z6e3qaK9iZEGGxsugJIv4aN3opCJa5DwRjVRjTjmsQTnn1jgOOmJudRQgCv5uXojJrcYgg==@linaro.org X-Google-Smtp-Source: AGHT+IFcC9yzE5jt8m+3kVDkRf7vjNaKlPKg/bvhQuGawYa6YG7AXwoNUzC56wv6P519U3qRkSMU X-Received: by 2002:a05:622a:5610:b0:461:52b3:7ce5 with SMTP id d75a77b69052e-462ab2ea924mr246579871cf.37.1730819145712; Tue, 05 Nov 2024 07:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730819145; cv=none; d=google.com; s=arc-20240605; b=ketgqhINm0yeb9pn6dMJi7On4VrOzBRRcNjD/g9apYlerFYQzizK5xAzuxykdcYXcL PF/SCwb3rQrNPr6SIEdpX8BHzD7Bxebgq/BnfppS7p43xf5WRJuWbfuXAyJ5dbVFhPbn AFpVHTxt3eMryT1vlyjo4z+qqpQ5YwNQuheVOhBhQdBdFKZO0mlWJ0zH/VTtxp7vcL1f xjH0qkVy1bNb/2NTGlVvzE5M7NKwZA6yfulzEBKb9+5Uj6oRhA0bo9nqPn5D634RsgTK kJXkiXsPhMZOGqKS+JQ59f81/Jtxv1kYOgucxPBJlqeXEL9nRBb5/IwAd9j/LJq34NCm NfCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eaNGgA/3s4B5UQl+uW6P+WyGFlnv2zD4SxX8VdqUOa8=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=Pcm68UrSae6JsY4mBOaZ2ObKBdL2y40quaSFrtMb5svUuU5tRj/90QQrwOWLJL+8dQ vRsSXaJny4HrZaJYCxMfp+ylQSOKQ2KwebCBxTqmCcpXJQkKVMw9RRe/Ihuag/d1YgZ4 FIGr1dtRW2bcvNd5jIOmQsXzujKLHhK5QAtGKKWmZrH2BQFrajo96DNkTqh2cR6GhsS3 fuwbXPfGYLq1AAdbcamAtqvhV7rBpjFdW4DktgFH2sBEGamfoTEP1u6Fdv3PWfTsVJW1 eSKoDIrUGLDhwK2dzZ1MOntQ26/su2K0504sq7/Ol0moT93QPFxaGXVupRpTqpie7MKR MO0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZUkIs3Va; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ad19ec10si147027571cf.367.2024.11.05.07.05.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 07:05:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZUkIs3Va; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8L6N-0000rW-C5; Tue, 05 Nov 2024 10:04:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8L67-0000qO-E5 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:04:01 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8L64-0000sK-SV for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:03:58 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-431695fa98bso44018095e9.3 for ; Tue, 05 Nov 2024 07:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730819035; x=1731423835; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eaNGgA/3s4B5UQl+uW6P+WyGFlnv2zD4SxX8VdqUOa8=; b=ZUkIs3VaUAJ+KUEx1dzh4PFyO4K9fk0L8XR0ZAUm/Dsl0gb71GIhEkxtcsaPfdAeow TfTZk7SvII0Dto4uP7KHtR7X4+dWH8WN7tHwEZEvNrZKHUt0PVWrhamsGJQgHwrog25M sP6yj+yvhG5yMIG4F9ZY+lqHZQWzBpdzpWCXPa1jwdbuIYRPpILAl47IvBkZtNyN82zS 4E3a19ld7zGi/XhxhjDdfEPO2I6ip4lMCzwSRWs38L6z3Tqf13dwuFv10aS55ArqD/0m Y6EIVHk/2DKRULNg4u1142ijmFy01Jb1ANkC5VlCBVIqEqCxshMiKU0YrLDf3t1hvGXN +Sjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730819035; x=1731423835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eaNGgA/3s4B5UQl+uW6P+WyGFlnv2zD4SxX8VdqUOa8=; b=iH4q7HNV9rPH7Kx2kUL+XIi9l6OGpb5WKNVgA0rVTkg2Xqd4LtcwxOgjzUFKaHKDAr 1B6XkpPljg2AVnp72dBJxK6AKFgI01Xgjla3edn8K279vg5fWDUR8NRsr3+FT0Gd0jZH Xg81MNi2bpnnyG+I1xJtAnsSq5fAji5ziRRMPBgrV3yAp3WQyJSxMHskvz+dt9QHa8MT piVwr/Mmm5bXoPZfuBTDgAFRkWkFZqx/VOsO3DBsAeq7UcUjg3wAnhIa6kGw3qhKmiI2 f0FK8svTQFfKdLH1QAvIXaATzz7P7+1qiB+QmTBONpGkakiU5Rap2/KRM6V93SpPzWU2 im6g== X-Gm-Message-State: AOJu0Ywqhdng/EftJnbi1hfttJjXDV/knD1ewywfj2d7WccwuqbLjLd7 HNUWvCU/p5ecScjpwrtmKI2gkthu+bUawV0XGFQ4/YOBi7RRhUDG9EYM6dHeOQyRLDxImd/gGdL aKhk= X-Received: by 2002:a05:600c:3b14:b0:426:8884:2c58 with SMTP id 5b1f17b1804b1-4319ac6fb0amr306289915e9.4.1730819034911; Tue, 05 Nov 2024 07:03:54 -0800 (PST) Received: from stoup.. ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9ca6f8sm221301855e9.39.2024.11.05.07.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 07:03:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 3/4] linux-user: Allow custom rt signal mappings Date: Tue, 5 Nov 2024 15:03:47 +0000 Message-ID: <20241105150348.446982-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241105150348.446982-1-richard.henderson@linaro.org> References: <20241105150348.446982-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Some applications want to use low priority realtime signals (e.g., SIGRTMAX). Currently QEMU cannot map all target realtime signals to host realtime signals, and chooses to sacrifice the end of the target realtime signal range. Allow users to choose how to map target realtime signals to host realtime signals using the new -t option, the new QEMU_RTSIG_MAP environment variable, and the new -Drtsig_map=\"...\" meson flag. To simplify things, the meson flag is not per-target, because the intended use case is app-specific qemu-user builds. The mapping is specified using the "tsig hsig count[,...]" syntax. Target realtime signals [tsig,tsig+count) are mapped to host realtime signals [hsig,hsig+count). Care is taken to avoid double and out-of-range mappings. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Message-ID: <20241029232211.206766-2-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/signal-common.h | 2 +- linux-user/main.c | 12 +++- linux-user/signal.c | 108 +++++++++++++++++++++++++++------- meson.build | 3 +- meson_options.txt | 2 + scripts/meson-buildoptions.sh | 2 + 6 files changed, 106 insertions(+), 23 deletions(-) diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index f4cbe6185e..8584d9ecc2 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -56,7 +56,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUArchState *env); void process_pending_signals(CPUArchState *cpu_env); -void signal_init(void); +void signal_init(const char *rtsig_map); void queue_signal(CPUArchState *env, int sig, int si_type, target_siginfo_t *info); void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); diff --git a/linux-user/main.c b/linux-user/main.c index 8143a0d4b0..b09af8d436 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -412,6 +412,13 @@ static void handle_arg_reserved_va(const char *arg) reserved_va = val ? val - 1 : 0; } +static const char *rtsig_map = CONFIG_QEMU_RTSIG_MAP; + +static void handle_arg_rtsig_map(const char *arg) +{ + rtsig_map = arg; +} + static void handle_arg_one_insn_per_tb(const char *arg) { opt_one_insn_per_tb = true; @@ -494,6 +501,9 @@ static const struct qemu_argument arg_table[] = { "address", "set guest_base address to 'address'"}, {"R", "QEMU_RESERVED_VA", true, handle_arg_reserved_va, "size", "reserve 'size' bytes for guest virtual address space"}, + {"t", "QEMU_RTSIG_MAP", true, handle_arg_rtsig_map, + "tsig hsig n[,...]", + "map target rt signals [tsig,tsig+n) to [hsig,hsig+n]"}, {"d", "QEMU_LOG", true, handle_arg_log, "item[,...]", "enable logging of specified items " "(use '-d help' for a list of items)"}, @@ -1002,7 +1012,7 @@ int main(int argc, char **argv, char **envp) target_set_brk(info->brk); syscall_init(); - signal_init(); + signal_init(rtsig_map); /* Now that we've loaded the binary, GUEST_BASE is fixed. Delay generating the prologue until now so that the prologue can take diff --git a/linux-user/signal.c b/linux-user/signal.c index 63ac2df53b..9b6d772882 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu/bitops.h" +#include "qemu/cutils.h" #include "gdbstub/user.h" #include "exec/page-protection.h" #include "hw/core/tcg-cpu-ops.h" @@ -513,20 +514,81 @@ static int core_dump_signal(int sig) } } -static void signal_table_init(void) +static void signal_table_init(const char *rtsig_map) { int hsig, tsig, count; + if (rtsig_map) { + /* + * Map host RT signals to target RT signals according to the + * user-provided specification. + */ + const char *s = rtsig_map; + + while (true) { + int i; + + if (qemu_strtoi(s, &s, 10, &tsig) || *s++ != ' ') { + fprintf(stderr, "Malformed target signal in QEMU_RTSIG_MAP\n"); + exit(EXIT_FAILURE); + } + if (qemu_strtoi(s, &s, 10, &hsig) || *s++ != ' ') { + fprintf(stderr, "Malformed host signal in QEMU_RTSIG_MAP\n"); + exit(EXIT_FAILURE); + } + if (qemu_strtoi(s, &s, 10, &count) || (*s && *s != ',')) { + fprintf(stderr, "Malformed signal count in QEMU_RTSIG_MAP\n"); + exit(EXIT_FAILURE); + } + + for (i = 0; i < count; i++, tsig++, hsig++) { + if (tsig < TARGET_SIGRTMIN || tsig > TARGET_NSIG) { + fprintf(stderr, "%d is not a target rt signal\n", tsig); + exit(EXIT_FAILURE); + } + if (hsig < SIGRTMIN || hsig > SIGRTMAX) { + fprintf(stderr, "%d is not a host rt signal\n", hsig); + exit(EXIT_FAILURE); + } + if (host_to_target_signal_table[hsig]) { + fprintf(stderr, "%d already maps %d\n", + hsig, host_to_target_signal_table[hsig]); + exit(EXIT_FAILURE); + } + host_to_target_signal_table[hsig] = tsig; + } + + if (*s) { + s++; + } else { + break; + } + } + } else { + /* + * Default host-to-target RT signal mapping. + * + * Signals are supported starting from TARGET_SIGRTMIN and going up + * until we run out of host realtime signals. Glibc uses the lower 2 + * RT signals and (hopefully) nobody uses the upper ones. + * This is why SIGRTMIN (34) is generally greater than __SIGRTMIN (32). + * To fix this properly we would need to do manual signal delivery + * multiplexed over a single host signal. + * Attempts for configure "missing" signals via sigaction will be + * silently ignored. + * + * Reserve one signal for internal usage (see below). + */ + + hsig = SIGRTMIN + 1; + for (tsig = TARGET_SIGRTMIN; + hsig <= SIGRTMAX && tsig <= TARGET_NSIG; + hsig++, tsig++) { + host_to_target_signal_table[hsig] = tsig; + } + } + /* - * Signals are supported starting from TARGET_SIGRTMIN and going up - * until we run out of host realtime signals. Glibc uses the lower 2 - * RT signals and (hopefully) nobody uses the upper ones. - * This is why SIGRTMIN (34) is generally greater than __SIGRTMIN (32). - * To fix this properly we would need to do manual signal delivery - * multiplexed over a single host signal. - * Attempts for configure "missing" signals via sigaction will be - * silently ignored. - * * Remap the target SIGABRT, so that we can distinguish host abort * from guest abort. When the guest registers a signal handler or * calls raise(SIGABRT), the host will raise SIG_RTn. If the guest @@ -536,21 +598,27 @@ static void signal_table_init(void) * parent sees the correct mapping from wait status. */ - hsig = SIGRTMIN; host_to_target_signal_table[SIGABRT] = 0; - host_to_target_signal_table[hsig++] = TARGET_SIGABRT; - - for (tsig = TARGET_SIGRTMIN; - hsig <= SIGRTMAX && tsig <= TARGET_NSIG; - hsig++, tsig++) { - host_to_target_signal_table[hsig] = tsig; + for (hsig = SIGRTMIN; hsig <= SIGRTMAX; hsig++) { + if (!host_to_target_signal_table[hsig]) { + host_to_target_signal_table[hsig] = TARGET_SIGABRT; + break; + } + } + if (hsig > SIGRTMAX) { + fprintf(stderr, "No rt signals left for SIGABRT mapping\n"); + exit(EXIT_FAILURE); } /* Invert the mapping that has already been assigned. */ for (hsig = 1; hsig < _NSIG; hsig++) { tsig = host_to_target_signal_table[hsig]; if (tsig) { - assert(target_to_host_signal_table[tsig] == 0); + if (target_to_host_signal_table[tsig]) { + fprintf(stderr, "%d is already mapped to %d\n", + tsig, target_to_host_signal_table[tsig]); + exit(EXIT_FAILURE); + } target_to_host_signal_table[tsig] = hsig; } } @@ -573,13 +641,13 @@ static void signal_table_init(void) trace_signal_table_init(count); } -void signal_init(void) +void signal_init(const char *rtsig_map) { TaskState *ts = get_task_state(thread_cpu); struct sigaction act, oact; /* initialize signal conversion tables */ - signal_table_init(); + signal_table_init(rtsig_map); /* Set the signal mask from the host mask. */ sigprocmask(0, 0, &ts->signal_mask); diff --git a/meson.build b/meson.build index c386593c52..9fa9d059ff 100644 --- a/meson.build +++ b/meson.build @@ -3178,7 +3178,8 @@ foreach target : target_dirs config_target += { 'CONFIG_USER_ONLY': 'y', 'CONFIG_QEMU_INTERP_PREFIX': - get_option('interp_prefix').replace('%M', config_target['TARGET_NAME']) + get_option('interp_prefix').replace('%M', config_target['TARGET_NAME']), + 'CONFIG_QEMU_RTSIG_MAP': get_option('rtsig_map'), } endif diff --git a/meson_options.txt b/meson_options.txt index 24bf009056..ac4887a622 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -27,6 +27,8 @@ option('block_drv_ro_whitelist', type : 'string', value : '', description: 'set block driver read-only whitelist (by default affects only QEMU, not tools like qemu-img)') option('interp_prefix', type : 'string', value : '/usr/gnemul/qemu-%M', description: 'where to find shared libraries etc., use %M for cpu name') +option('rtsig_map', type : 'string', value : 'NULL', + description: 'default value of QEMU_RTSIG_MAP') option('fuzzing_engine', type : 'string', value : '', description: 'fuzzing engine library for OSS-Fuzz') option('trace_file', type: 'string', value: 'trace', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 6f2bb08ecd..51ed46e46a 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -72,6 +72,7 @@ meson_options_help() { printf "%s\n" ' "manufacturer" name for qemu-ga registry entries' printf "%s\n" ' [QEMU]' printf "%s\n" ' --qemu-ga-version=VALUE version number for qemu-ga installer' + printf "%s\n" ' --rtsig-map=VALUE default value of QEMU_RTSIG_MAP [NULL]' printf "%s\n" ' --smbd=VALUE Path to smbd for slirp networking' printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]' printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string' @@ -460,6 +461,7 @@ _meson_option_parse() { --disable-replication) printf "%s" -Dreplication=disabled ;; --enable-rng-none) printf "%s" -Drng_none=true ;; --disable-rng-none) printf "%s" -Drng_none=false ;; + --rtsig-map=*) quote_sh "-Drtsig_map=$2" ;; --enable-rust) printf "%s" -Drust=enabled ;; --disable-rust) printf "%s" -Drust=disabled ;; --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;; From patchwork Tue Nov 5 15:03:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 840814 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp36190wru; Tue, 5 Nov 2024 07:05:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXsH5eend2gXRWINy8m09fg768NRqPU6dE1HcoHniK5c8MWFBtd51mJ8/9O7v2bzAED0xxwtg==@linaro.org X-Google-Smtp-Source: AGHT+IHGpJ5MGayycAkDdHx7P8K4QYIf0FulTJ4NaLK+m6CeYg0P4jzeXi5mTjLscB1ZdVAirNq5 X-Received: by 2002:ad4:4447:0:b0:6d1:8755:5cbe with SMTP id 6a1803df08f44-6d187555d86mr412720456d6.8.1730819124058; Tue, 05 Nov 2024 07:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730819124; cv=none; d=google.com; s=arc-20240605; b=bMC1KX2I78yhO3+qBh2dPYHHBplDkmhVilgwcZPbXZ7dh08OsOFsCveLcQngiKbQfR qaHzZsyuTLg3N7FT/jEE3PD6ga9DQCg/fYZ9AP5rcj2CnCje7o1JOmQEeJpw83M7xai+ L/6zIKavuPZfjU0X7Wd29cnkvG7R/VB4idJre/jRQsRwinCAnXmUYVH6lAq0oxD9HP0o q0Uk3yMMlaHR3oDHNe1kJGr4/4ZA1RzRE0Rh7JsjwRBD5LhD0MADGGb/IxsbMG7KF8Dr N7J/M5WliLd4fyfdeQSDeQ8vlxf9f9hBSlzuwlXRnLvaLtpQyvxv7kYbCBIPNHcQOjZU rlyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SQYS0DlDBWW5TkKFH2M/YnaXSSYT19q0Qc+ybblli20=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=SwotvY74nyqA6qFpr084Tt+lloc6ZlgWPQKqnUkIDvyz9yVJylL4QzCswFtdlOp++U kNsXsB494eJXnydXA1sYFZqHsyQYgpXt3JTQ8etX886FIX9eIKv31MEcbR0UHkBkinoX DeN3FheXLu9mDjcO1qkvs7hTx/8t9FSyBVkgtLRDP4AikDXWi3d3xJTG5Ugv4S9Axvyn +KHUFS4+pkWUSHZ0uFprfzLkprI4MINatzzBc4v7fgEthpReWnRA04WdSOeTRxURWj7n WvoVify7uzUsoxgDPlATDjmHPTNgC44nOHd2q+172lFrAlqW9KckyriPNjwNXmIAZW1Y Zdbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmlHLf8g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b2f3a816a4si1335934785a.311.2024.11.05.07.05.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 07:05:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmlHLf8g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8L6O-0000re-KP; Tue, 05 Nov 2024 10:04:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8L67-0000qP-No for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:04:01 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8L65-0000sY-Ut for qemu-devel@nongnu.org; Tue, 05 Nov 2024 10:03:59 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43193678216so47929655e9.0 for ; Tue, 05 Nov 2024 07:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730819036; x=1731423836; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SQYS0DlDBWW5TkKFH2M/YnaXSSYT19q0Qc+ybblli20=; b=pmlHLf8gJChHXGGiHXvQtUF0FHiLMxXQnaHMt6t09DqRKiQF+bEVuKsjrhJuC0OQpa RuIP8YtvlADxs1FIbLGVciTYkxtD0qK8tDGjmqQ36RucYb06NDfa9XruwuhoxNQg4+PI V2uhwmjMvUdUnAdrE5G10+BnArJgpTs07sPgq4wW3baAvVjzGlmjXzJ66I0NgfezAs+c N2X2R2Z0JForzZXW7VllmhQhIQ6wvDwKsXa28X2Ag0CowGeljIF9Ze9BiF+leIlO0jXi KS2FZLCpXg7UzEbe3cztmRvwzdXG02od5l9h4NFdBxFQPqc5hbmvBveSruYzoUoNtUYY qK3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730819036; x=1731423836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SQYS0DlDBWW5TkKFH2M/YnaXSSYT19q0Qc+ybblli20=; b=fZY+HyKplZkNEht7GIfVYyzv9Pg1BzYftL/Rs9pAn2hDA7Up5OMmCDvASb1im9XmuG NamkM2hUFMv+sSXrsLLFUf92npwCfSEusWAVxXHes11x4PTwaUd7nAHvDShdBLS6ZsFj W7cGi0zpBMRT/E9EoqRgsp56LqqkKKoZXvaFd9Du+PcRDrhAq4XtTHQvVUv2UsBSISxk 2wT4HmdaCKs9BRLepGPQjMduhOV8Vl7maiTvLO1oT2PD8KC1V2aKOm/HGkHI/4JURlS5 YEvqHBkPgeLwUvjgr+t2i4VNX3AbwsDegDoE8SQOFiioqLOIyjZiF+8QACjIzJDen1i0 0Pkw== X-Gm-Message-State: AOJu0YxaKu/8O6FLLwqJA8zmf4iWWpTRuEAqLd2dyvNNxGbJQsP4nFeV oPskPRM0/Km4SEXHzRUdcihbwc5KghECZlAiMQxW5bTty739IxMimS37kpuuLkGt9jJq7/fmNOw oy+s= X-Received: by 2002:a05:600c:458e:b0:42c:baf9:bee7 with SMTP id 5b1f17b1804b1-4328250f211mr168768985e9.12.1730819035876; Tue, 05 Nov 2024 07:03:55 -0800 (PST) Received: from stoup.. ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9ca6f8sm221301855e9.39.2024.11.05.07.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 07:03:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 4/4] tests/tcg: Add SIGRTMIN/SIGRTMAX test Date: Tue, 5 Nov 2024 15:03:48 +0000 Message-ID: <20241105150348.446982-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241105150348.446982-1-richard.henderson@linaro.org> References: <20241105150348.446982-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Test the lowest and the highest real-time signals. This requires configuring the real-time signal mapping, and therefore some knowledge about the host. To this end, pass the emulator path in the QEMU environment variable to all tests (this should not disturb the existing ones), and assume that all hosts have signals 36-39 available. Signed-off-by: Ilya Leoshkevich Message-ID: <20241029232211.206766-3-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/multiarch/linux/linux-sigrtminmax.c | 74 +++++++++++++++++++ tests/tcg/Makefile.target | 4 +- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/multiarch/linux/linux-sigrtminmax.c diff --git a/tests/tcg/multiarch/linux/linux-sigrtminmax.c b/tests/tcg/multiarch/linux/linux-sigrtminmax.c new file mode 100644 index 0000000000..a7059aacd9 --- /dev/null +++ b/tests/tcg/multiarch/linux/linux-sigrtminmax.c @@ -0,0 +1,74 @@ +/* + * Test the lowest and the highest real-time signals. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include +#include +#include +#include + +/* For hexagon and microblaze. */ +#ifndef __SIGRTMIN +#define __SIGRTMIN 32 +#endif + +extern char **environ; + +static bool seen_sigrtmin, seen_sigrtmax; + +static void handle_signal(int sig) +{ + if (sig == SIGRTMIN) { + seen_sigrtmin = true; + } else if (sig == SIGRTMAX) { + seen_sigrtmax = true; + } else { + _exit(1); + } +} + +int main(int argc, char **argv) +{ + char *qemu = getenv("QEMU"); + struct sigaction act; + + assert(qemu); + + if (!getenv("QEMU_RTSIG_MAP")) { + char **new_argv = malloc((argc + 2) + sizeof(char *)); + int tsig1, hsig1, count1, tsig2, hsig2, count2; + char rt_sigmap[64]; + + /* Re-exec with a mapping that includes SIGRTMIN and SIGRTMAX. */ + new_argv[0] = qemu; + memcpy(&new_argv[1], argv, (argc + 1) * sizeof(char *)); + tsig1 = __SIGRTMIN; + /* The host must have a few signals starting from this one. */ + hsig1 = 36; + count1 = SIGRTMIN - __SIGRTMIN + 1; + tsig2 = SIGRTMAX; + hsig2 = hsig1 + count1; + count2 = 1; + snprintf(rt_sigmap, sizeof(rt_sigmap), "%d %d %d,%d %d %d", + tsig1, hsig1, count1, tsig2, hsig2, count2); + setenv("QEMU_RTSIG_MAP", rt_sigmap, 0); + assert(execve(new_argv[0], new_argv, environ) == 0); + return EXIT_FAILURE; + } + + memset(&act, 0, sizeof(act)); + act.sa_handler = handle_signal; + assert(sigaction(SIGRTMIN, &act, NULL) == 0); + assert(sigaction(SIGRTMAX, &act, NULL) == 0); + + assert(kill(getpid(), SIGRTMIN) == 0); + assert(seen_sigrtmin); + assert(kill(getpid(), SIGRTMAX) == 0); + assert(seen_sigrtmax); + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 9722145b97..95ff76ea44 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -179,10 +179,10 @@ run-plugin-%-with-libmem.so: PLUGIN_ARGS=$(COMMA)inline=true ifeq ($(filter %-softmmu, $(TARGET)),) run-%: % - $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<) + $(call run-test, $<, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) $<) run-plugin-%: - $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + $(call run-test, $@, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(call strip-plugin,$<))