From patchwork Tue Sep 10 12:03:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Syromiatnikov X-Patchwork-Id: 11139309 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4823924 for ; Tue, 10 Sep 2019 12:03:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CD5B21479 for ; Tue, 10 Sep 2019 12:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728955AbfIJMDr (ORCPT ); Tue, 10 Sep 2019 08:03:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57956 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726066AbfIJMDr (ORCPT ); Tue, 10 Sep 2019 08:03:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE3D8C00861E; Tue, 10 Sep 2019 12:03:46 +0000 (UTC) Received: from asgard.redhat.com (ovpn-112-63.ams2.redhat.com [10.36.112.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31EDA5D9D6; Tue, 10 Sep 2019 12:03:42 +0000 (UTC) Date: Tue, 10 Sep 2019 13:03:16 +0100 From: Eugene Syromiatnikov To: linux-kernel@vger.kernel.org, Christian Brauner , Shuah Khan , linux-kselftest@vger.kernel.org Cc: Adrian Reber Subject: [PATCH 2/6] selftests/clone3: add a check for invalid exit_signal Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 10 Sep 2019 12:03:46 +0000 (UTC) Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Check that the kernel fails calls with exit_signal with non-zero highest 32 bits. * tools/testing/selftests/clone3/clone3.c (enum test_mode): Add CLONE3_ARGS_BIG_EXIT_SIGNAL. (call_clone3): Add args.exit_signal initialisation in case test_mode == CLONE3_ARGS_BIG_EXIT_SIGNAL. (main): Add test_clone3 clone check with test_mode == CLONE3_ARGS_BIG_EXIT_SIGNAL. Signed-off-by: Eugene Syromiatnikov --- tools/testing/selftests/clone3/clone3.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c index 7b65ee5..4f23a0c 100644 --- a/tools/testing/selftests/clone3/clone3.c +++ b/tools/testing/selftests/clone3/clone3.c @@ -28,6 +28,7 @@ enum test_mode { CLONE3_ARGS_NO_TEST, CLONE3_ARGS_ALL_0, CLONE3_ARGS_ALL_1, + CLONE3_ARGS_BIG_EXIT_SIGNAL, }; static pid_t raw_clone(struct clone_args *args, size_t size) @@ -72,6 +73,10 @@ static int call_clone3(int flags, size_t size, enum test_mode test_mode) args.tls = 1; args.set_tid = 1; break; + + case CLONE3_ARGS_BIG_EXIT_SIGNAL: + args.exit_signal = 0xbadc0ded00000000; + break; } pid = raw_clone(&args, size); @@ -146,6 +151,10 @@ int main(int argc, char *argv[]) /* Do a clone3() with all members set to 1 */ if (test_clone3(0, CLONE3_ARGS_SIZE_V0, -EINVAL, CLONE3_ARGS_ALL_1)) goto on_error; + /* Do a clone3() with exit_signal having highest 32 bits non-zero */ + if (test_clone3(0, CLONE3_ARGS_SIZE_V0, -EINVAL, + CLONE3_ARGS_BIG_EXIT_SIGNAL)) + goto on_error; /* * Do a clone3() with sizeof(struct clone_args) + 8 * and all members set to 0.