Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3519566pxb; Mon, 4 Apr 2022 19:40:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuRuCdMvtJFblonup8+WKqkRSUbAEauNjHV02tJTiMQqKxQtQB3OU+wJWAeazuZdfVYgxG X-Received: by 2002:a17:903:110f:b0:154:c7a4:9371 with SMTP id n15-20020a170903110f00b00154c7a49371mr1287895plh.75.1649126454570; Mon, 04 Apr 2022 19:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649126454; cv=none; d=google.com; s=arc-20160816; b=sdw7o+dhB1yZMnxWIR25VNSudYYqpL/aPymnVtzQoGQKxCmiKTi1JZ47EkB1FBg9k+ AUTRdngoGKgHIp/9na/+utn65TJhJynq2PuAbqHO8iNcl+LUen3a4L0kFiqApG9cU6QK dwmbOYxN3gZXSAOMGmv/H67+GHZs1Nwcuag+/CRUC1A9lAXEx9iEr2VTssQSs3paRm1R TiFG8sz8UpwpEOlu2lynA1hx4Goh0GjuQW6Jn66ukoMQUbI2TnFdNTNUgSdqAAlhWyYX D6nH/JJNBetwEzXeAlbUFR3xfBSD1NffDCr8LFnoyjRQ1r8/ziZ9ybUYZ0izxzpF+9/i +DzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Y59NLsG6T0rO1uDSjSV3YCHA2EEUr41Jyu9pU48AypU=; b=0icbsJypCtssQ4Dygs7kF7h+NqsCiMygeVu5teIbs0blq3k9iUxWYoi7Zut3FjLxBz 0L/WaIhalATYXOCQU9bSTxEvuuEQ2fEjYWNynSoyKpOcAX6DJYYIIU8jNcb+e37IaU7x 50CjSEYzQN+t/wRq31Kw16IFUlKKqJK6No7r21Hezrjfy0lc7in+YTOUx3GCuj4HuM3r Xz4MqkkLylIYawyivV+ntb6AuRkyvD0tiYSd+DF2Cns3K7gM0CNqZAFkSqlMskjHRABd 6kmmRinlN9r74dNd+NSmxwdo4XILuR6J2JTBnUIUE49N0zPrOjJYg0qQ+AsFjoC8ucWJ lAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=izcHfkXq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q28-20020a63505c000000b003816043f061si11270071pgl.598.2022.04.04.19.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:40:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=izcHfkXq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EF9EB2DD388; Mon, 4 Apr 2022 18:04:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353324AbiDAWUf (ORCPT + 99 others); Fri, 1 Apr 2022 18:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347803AbiDAWU3 (ORCPT ); Fri, 1 Apr 2022 18:20:29 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06AF83878D; Fri, 1 Apr 2022 15:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648851518; x=1680387518; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Ib5lnXmoJA4QJKvWOoMpeHIvErHafsZXbhOJjciS+tI=; b=izcHfkXq3nqg2FzeIrWizcXIxN/N+9Bn0xS+z8+C+EgCi0DN1KS98/UI iQDnqhx9V6uWRD7vgu7qSUMjqeEO1fqFDrqhuG0GcmMmPR84p7Gf6B3xR YrNrSqIjXxHe/J+zdXsHK2ts9QS31ncRAZFxMZhPCNGn3am45qtbFL//H rJYmzABsQ02MQP0/0guvTSJE49cDB7o5CdhXODSXF3DvuNFjHhTro2Mw5 RsIr7BRDJNqPA8q317qmBVXQXx6uVpsChP+S1Xm+1PJkobhSKwQ1mlB+G B4KwGgewJK9vdgGRKZG35NaM0u15NIPJ048T7hRBfW2xZtAEoVruxpSum w==; X-IronPort-AV: E=McAfee;i="6200,9189,10304"; a="257822124" X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="257822124" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2022 15:18:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="567860540" Received: from chang-linux-3.sc.intel.com ([172.25.112.114]) by orsmga008.jf.intel.com with ESMTP; 01 Apr 2022 15:18:35 -0700 From: "Chang S. Bae" To: linux-kselftest@vger.kernel.org, shuah@kernel.org, linux-kernel@vger.kernel.org Cc: dave.hansen@linux.intel.com, tglx@linutronix.de, bp@suse.de, chang.seok.bae@intel.com Subject: [PATCH 1/2] selftests/x86/signal: Adjust the test to the kernel's altstack check Date: Fri, 1 Apr 2022 15:10:13 -0700 Message-Id: <20220401221014.13556-2-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220401221014.13556-1-chang.seok.bae@intel.com> References: <20220401221014.13556-1-chang.seok.bae@intel.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The test assumes an insufficient altstack is allowed. Then it raises a signal to test the delivery failure due to an altstack overflow. The kernel now provides an option to tweak sigaltstack()'s sanity check to prevent an insufficient altstack. ENOMEM is returned on the check failure. Adjust the code to skip the test when this option is on. Signed-off-by: Chang S. Bae Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- tools/testing/selftests/x86/sigaltstack.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/sigaltstack.c b/tools/testing/selftests/x86/sigaltstack.c index f689af75e979..22a88b764a8e 100644 --- a/tools/testing/selftests/x86/sigaltstack.c +++ b/tools/testing/selftests/x86/sigaltstack.c @@ -88,8 +88,18 @@ static void sigalrm(int sig, siginfo_t *info, void *ctx_void) static void test_sigaltstack(void *altstack, unsigned long size) { - if (setup_altstack(altstack, size)) + if (setup_altstack(altstack, size)) { + /* + * The kernel may return ENOMEM when the altstack size + * is insufficient. Skip the test in this case. + */ + if (errno == ENOMEM && size < at_minstack_size) { + printf("[SKIP]\tThe running kernel disallows an insufficient size.\n"); + return; + } + err(1, "sigaltstack()"); + } sigalrm_expected = (size > at_minstack_size) ? true : false; -- 2.17.1