From patchwork Fri Mar 29 22:20:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784082 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426474wrt; Fri, 29 Mar 2024 15:21:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaUhrN5XwtLJzA/3/meJrzdAnGFN4AN0uv954OWm08SGQXoY/rfrreQl+n2kbr/TCY6UckalHcpkLdk+8GTtxt X-Google-Smtp-Source: AGHT+IEwNIIJaATuf5fWpoW+GHfFOAZFtDm9Hjm0QTa8IZ2Yu1blR3uHIOnVKl60CAkkoICvzn0Z X-Received: by 2002:ae9:e706:0:b0:78b:c23e:b241 with SMTP id m6-20020ae9e706000000b0078bc23eb241mr3749374qka.50.1711750912093; Fri, 29 Mar 2024 15:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750912; cv=none; d=google.com; s=arc-20160816; b=SSBTOzu1S7SrZeBLJaFdVK5nYcAC5lMt0d/8lzk1Qr7XyvwR/lAqPyad14pyWJ95wq jMuJ9Bi3DYv61SvQBXJTKdOiFPvGW7i+3NUeveClrur6cY7NW7zzXQprxDCwdtsB4D8O y5N2i1s8sbM4dEVn8+5IjhXp9bUuix66V7nNQh5ox+2A6oH7nkTcHZSEdLJDZap5QQv0 VRXd2t3kVrxJwx6t/VbTsVnElA/GWrcOaZ9+6gmnCBpCoHmXaFBaq4RlMTKWOfRyKPV6 Kmc6Q7kvCcv6yfN734gXTJJc4Z8IgkBkRZCjZb+CAuKi434LWScQGtNqy5RBILxCez33 SmNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=NS4U9U88Ng1my/BHrf/5fnOHfKUgUSS5XUDMJ1D2LmMNQLdnnQbSKLfnpO0VHJz1nT FUT/B8nYT2Dmwewx8Dm4daTCt/EoMbbJ0BCX1SGYAFlMobRVDJDD5CWHa/yKIRWrfU+q nru8qESmJPAF38DzeNTmeBZ3Hydw7Y7REXaG/QHCRMzal79OpSZgrpywLW034Yk/XKA3 SiOLrML0NxeI/ByoYzZTzEmoVJL+3U6fqdD35/L0SCEkJRinwyTHHbbFg1vcDFiGbB8Z sdyMdElONW6/bvQQgq40mliyb3IqW8Wn74klw8a7abVLMYkYb3ogOn/9ALSXgVduLCAB a4lg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c7dTs2Jw; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c11-20020a05620a164b00b00789d99cc609si4549852qko.549.2024.03.29.15.21.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:21:52 -0700 (PDT) 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=c7dTs2Jw; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqKag-00056k-LG; Fri, 29 Mar 2024 18:20:50 -0400 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 1rqKaf-00056J-IG for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:49 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKae-0001pR-0Y for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:49 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-229b7ada9e8so980647fac.0 for ; Fri, 29 Mar 2024 15:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750846; x=1712355646; 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; b=c7dTs2JwE0gy2Q8yHxazYc7sPPaBgrCh2EDRtBJdHAwRz3zTnOi0N6yUzE3g8N4bm7 TBJE6tryTOBnknZyYihdFhq5k454FUefOst9YxtBQ991Q1yQaTT/x5vCr6j2esiFswo1 DAysLqzti4QsxFgewjO7m1lhGXubFHBU6+z/r0FOHV6y+CNNQyaEeWF+PCEBhVqRSjQ7 UJf6bnC2NArSZUJt+k5RBZZal6D0rY2s2zNdi9gViBc2xgGOX/0c7OydCfOFw3ZQDFSc Uw7cKspc6L/A3XWEsVukN6EkVNLXrjIcZxnLxAhwgZK2y4aqXGvf83M1lgWKyXwkDrtj yfxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750846; x=1712355646; 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; b=Is5hau9MXInH+WK40584xk9QpbV6y3/E5cGEsZv8g1NjJXGGVMUkJlH0+8d9T/Gudl fDzw81Xh2flTCprDVAFcAGdQG5ETYUQst/qrFLGoEEFdHkSNTv5vjVWrRfU0RTVbTMoK BwW6H2TsmJp8ylDwXD1AAVkfHr0XmRYFFVs8nCydcTjiCfIJlQ3Z0raCo8rCxcNhGokO 2LLrwQ4kqTGWyKhhhpDYUxCXT4t6/xLz4ddBBz4ia/MmJ3dt4BTKTDOggrTrVcewqB+s wbZ1XnZo/9/xUVxgt+uRPDF4m3NsH97j3xsS9RGBHT+OLbJ9ptQaGkn8aniGkElCDqBz Xkeg== X-Gm-Message-State: AOJu0YzV/+i2nck+OS1Q+FmIDHMfH/jaStrCirfCHFuGqbac4wCGs8UZ sl9lwBHPfKdN5dK71edNTC5RV8ljwoXo8l2D9PPXIJiZqpQuyl4fWoZTBtRkLLJXFAabl0bQSSV G X-Received: by 2002:a05:6871:340c:b0:22a:551c:3170 with SMTP id nh12-20020a056871340c00b0022a551c3170mr3672097oac.23.1711750846598; Fri, 29 Mar 2024 15:20:46 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 4/7] tests/tcg: Test shmat(NULL) Date: Fri, 29 Mar 2024 12:20:34 -1000 Message-Id: <20240329222037.1735350-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x30.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 Add a small test to prevent regressions. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240325192436.561154-5-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/multiarch/linux/linux-shmat-null.c | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/tcg/multiarch/linux/linux-shmat-null.c diff --git a/tests/tcg/multiarch/linux/linux-shmat-null.c b/tests/tcg/multiarch/linux/linux-shmat-null.c new file mode 100644 index 0000000000..94eaaec371 --- /dev/null +++ b/tests/tcg/multiarch/linux/linux-shmat-null.c @@ -0,0 +1,38 @@ +/* + * Test shmat(NULL). + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include + +int main(void) +{ + int shmid; + char *p; + int err; + + /* Create, attach and intialize shared memory. */ + shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT | 0600); + assert(shmid != -1); + p = shmat(shmid, NULL, 0); + assert(p != (void *)-1); + *p = 42; + + /* Reattach, check that the value is still there. */ + err = shmdt(p); + assert(err == 0); + p = shmat(shmid, NULL, 0); + assert(p != (void *)-1); + assert(*p == 42); + + /* Detach. */ + err = shmdt(p); + assert(err == 0); + err = shmctl(shmid, IPC_RMID, NULL); + assert(err == 0); + + return EXIT_SUCCESS; +}