From patchwork Fri Jan 5 15:54:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13512324 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EB17C47077 for ; Fri, 5 Jan 2024 15:54:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBE096B02F2; Fri, 5 Jan 2024 10:54:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C6E266B02F3; Fri, 5 Jan 2024 10:54:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B35706B02F4; Fri, 5 Jan 2024 10:54:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A44656B02F2 for ; Fri, 5 Jan 2024 10:54:32 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 71593140520 for ; Fri, 5 Jan 2024 15:54:32 +0000 (UTC) X-FDA: 81645704784.12.B88B04D Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf20.hostedemail.com (Postfix) with ESMTP id A4CAB1C0016 for ; Fri, 5 Jan 2024 15:54:30 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of breno.debian@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=breno.debian@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704470070; a=rsa-sha256; cv=none; b=ev8fjaqXnIwhPq3FYuDbszFaLDB6dKurYM3Qv4EtqTdYeGa9CKnriyP3cwYtFjF8zboJGe QNDivqvYSdMldpP6oXXwsj3MYMYl+bzm2VS86oF90GYS2xckgd81TEZxj1pigQELRzGmRh tVG1BMWtXpPe8pfQ3ny+O9nFE5FM8YE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of breno.debian@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=breno.debian@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704470070; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=w6wG9ZzYTMIbl90MDDwci6aGriZP9ArruE6XkOlXJdQ=; b=sx+/T5Nu7fu64IAM5fzG9c6aQLZXhRGZHPEKQg3FugmyMVG0SX6ppJccCBPhjCh1fH2J+u e3XRXEgpJOMeM1SNnFDkJLptKO4tYCNVHeEEqdj4oGtZqEGYiuFlIxsiqPjWdkn9FaptRy KxeZKBRnVx8QQrmYPX3XaLp2HbbyGzQ= Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-556275957ccso1905074a12.0 for ; Fri, 05 Jan 2024 07:54:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704470069; x=1705074869; 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=w6wG9ZzYTMIbl90MDDwci6aGriZP9ArruE6XkOlXJdQ=; b=GLnyHI8UJ3ubFUXy2A9r22Ny5sjsf+CpcRt/2HNvbSupj5e+23n9VyRivKShhPWK15 7smFGIOaJUNC4OmMwvSYN16NxiabQL0Ye0CglhBEasrA/ipDSD/NqTnZzGXgh6poQbBc tGbldEWdNA1Sjh465x9WFQeGa4v4QZcKzkm4QQE6P9KrA0BR+PauK6nBNTVNlHPqQlaY 6Ez4E0Xp+cKaBG1H+wy+bgTRwEbnKRB4VdQhnKyHpTVHb+djWCuPZE+vot8MLAzYWOZw mPEur9+TFuSlnxOYfanexV3bt2aSWfd2JIyK1YT5uvMNr6qd3gqHKg8xoT0/3WgvlUi+ gxPw== X-Gm-Message-State: AOJu0YySWxWHCPP/HyO64zZbBDYZIXzbbg2GW6GkGsMffJTGEuVnKzTJ 8eRkHlTcy9Cj07ZHjow2UWs= X-Google-Smtp-Source: AGHT+IFnY2eub3jodcxLJrdqZq9ALnlRArPvDy89eZBPUJ60FNMFUhpMIIn/6e8CsBhUx8frDBSmQw== X-Received: by 2002:a50:c219:0:b0:557:d32:fe2 with SMTP id n25-20020a50c219000000b005570d320fe2mr506778edf.47.1704470069019; Fri, 05 Jan 2024 07:54:29 -0800 (PST) Received: from localhost (fwdproxy-cln-001.fbsv.net. [2a03:2880:31ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id 3-20020a508e03000000b0055515b40464sm1110374edw.81.2024.01.05.07.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 07:54:28 -0800 (PST) From: Breno Leitao To: riel@surriel.com, linux-mm@kvack.org, akpm@linux-foundation.org Cc: vegard.nossum@oracle.com, rppt@kernel.org, songmuchun@bytedance.com, shy828301@gmail.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/1] selftest/mm/hugetlb: SIGBUS on stolen page Date: Fri, 5 Jan 2024 07:54:18 -0800 Message-Id: <20240105155419.1939484-1-leitao@debian.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A4CAB1C0016 X-Stat-Signature: 6inx6xmneh16f1ou94yqdbggm3xe4cmn X-Rspam-User: X-HE-Tag: 1704470070-519629 X-HE-Meta: U2FsdGVkX19xbMuL6HXJpn+GwSL8+Psj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B0THUvrkuMo0dToKhUfAMe87YSWm/L4jfYu9cNnW0NVd13L5QeZMuVlfA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000013, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This test case triggers a race between madvise(MADV_DONTNEED) and mmap() in a single huge page, which got stolen (while reserved). Once the only page is stolen, the memory previously mmaped (and madvise(MADV_DONTNEED) got a SIGBUS when accessed. I am not adding this test to the un_vmtests.sh scripts, since this test fails at upstream. Breno Leitao (1): selftests/mm: add a new test for madv and hugetlb mmap tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/hugetlb_madv_vs_map.c | 124 ++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 tools/testing/selftests/mm/hugetlb_madv_vs_map.c