Received: by 10.192.165.148 with SMTP id m20csp678411imm; Wed, 2 May 2018 07:07:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrXKU3OiklO54Xtp7myYrLdJi1GuFPYd5AjzpEIKHV6S3cBj+5Ui8HEMQy/+aAZd0SeApol X-Received: by 2002:a17:902:8c83:: with SMTP id t3-v6mr16465356plo.357.1525270028200; Wed, 02 May 2018 07:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525270028; cv=none; d=google.com; s=arc-20160816; b=E6r8khrSH3BcqctUDComcSFCIr5BJq6meTry9F2N9NGGHGsOpMV1Qhehd5cvuy/nxb Du4eP2ePqRP2rYFLUcEe+1XI1uidwR8IM3flp1xag3xPmnS56jxJ6rwg4dH2LcznhZ72 q8ku7MKMfl608oXy5r9wx0cICpTWGCN6JjlL049aHE5KdyR2uOOQSW8ZNF1JhVMYgLFj CxoGiClL/lNvb/UqzHKSmPxNbzbqlf82qANR3E7KIY/NLx8ckruUS/wktZ5wopXGqtt4 G/AFTU/IbUUQN5cm9Ugt6YIz6I8qa961kcaQZ0ClKX4MzWHaA1v0AeBWMldumiDpau9Z SOIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=TuzoM+JvlNlOSYPVrQWLykZy4LlJ1fnbI+2IjltW+gU=; b=lPWImCEow8sa/XjRnrnICMwZLYvbuUdzHVsnGi45qD5G99zfTrvgLQJ+Qx1lCwhBWY zowK6N8jB+yleTcl0zQ5yx4uFxgoO12osT97mB+psRErHevDrX+P5PbomU4sLhvDlas1 D/lUUf/5ADGcfQX4kaMXBaSaRTZUpRI3URycabzoQRxh5mEgHlR0R0l2q5PcZ8wHMJ7E EGkkj6LwmdDoxRll2eWikPQXI7J03FL6V4Sz3QasgZWroquhG9me34Bzto5TJNXwRyio nqHuOstdOOCIr6VFzTIfgSV5PftUXZceJnFa80o+UY/gqbd0q2UvgZGIX9Be37j0MmZT ugog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21si11168620pfo.31.2018.05.02.07.06.54; Wed, 02 May 2018 07:07:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751538AbeEBOFV (ORCPT + 99 others); Wed, 2 May 2018 10:05:21 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:52531 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbeEBOFR (ORCPT ); Wed, 2 May 2018 10:05:17 -0400 Received: from mail-vk0-f71.google.com ([209.85.213.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fDsNf-0001Ol-Sm for linux-kernel@vger.kernel.org; Wed, 02 May 2018 14:05:16 +0000 Received: by mail-vk0-f71.google.com with SMTP id y22-v6so12162178vky.6 for ; Wed, 02 May 2018 07:05:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TuzoM+JvlNlOSYPVrQWLykZy4LlJ1fnbI+2IjltW+gU=; b=McXdbI9KXUYqlK9oHn1ykHAhLSq4NA55Kwph3N67wZMlG821gDtCGlPRwMYvi0MqYj RQCVRafRLzEGorrjoHWFv5eL3AUmpw6+mseN9K+W7gQuyf/cbNWIOXo3QYjjE7L6IEJ7 qHFAjOjf9Vvd+DgkHzxu7xc2cWKR2YX5LUF+zOCNhJWpju3uIYlV3bzoDvTw+8SMTAlJ Bixb006gVX04SuaxghnlKKXIiRI44sZ1/LedId4NyGoyvPGZ7VCXJVCn/1FRSMtp25Ld KrNm4Wivh3DDpEogaVIFDKtpGUJklW4t+AEyMfLC9WtsgqrZfUiRpi4eOnhsldmjZO9s Yx6g== X-Gm-Message-State: ALQs6tA2fMFgCRP2PGuPWF3cL4CCUdsT4+eE4dC0Gz/sT/Gr3RynNf6X 9xemS047HalIaFssWe1RSdEOaYgnKTgvaA1cIzqpfDGxbb1ufhLdU5dsguAxfjp1RJ8aR4Vxr71 QdQd1uzXDGcYpmZNzdSJrk2Meza3fKUYdCR1+35HfexJ/lNeNXHWmQUK/jw== X-Received: by 2002:a1f:8e82:: with SMTP id q124-v6mr18548981vkd.161.1525269914450; Wed, 02 May 2018 07:05:14 -0700 (PDT) X-Received: by 2002:a1f:8e82:: with SMTP id q124-v6mr18548906vkd.161.1525269913748; Wed, 02 May 2018 07:05:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.171.1 with HTTP; Wed, 2 May 2018 07:05:13 -0700 (PDT) In-Reply-To: <20180418075256.300-1-anders.roxell@linaro.org> References: <20180418075256.300-1-anders.roxell@linaro.org> From: Christian Brauner Date: Wed, 2 May 2018 16:05:13 +0200 Message-ID: Subject: Re: [PATCH 1/2] selftests/filesystems: devpts_pts included wrong header To: Anders Roxell Cc: shuah@kernel.org, Linux Kernel Mailing List , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 09:52:55AM +0200, Anders Roxell wrote: > We were picking up the wrong header should use asm/ioctls.h form the kernel > and not the header from the system (sys/ioctl.h). In the current code we > added the correct include and we added the kernel headers path to the CFLAGS. > > Fixes: ce290a19609d ("selftests: add devpts selftests") > Signed-off-by: Anders Roxell > --- Acked-by: Christian Brauner Patch looks good to me. I'm going to look into the ioctl() error. Thanks! Christian > > Hi, > > I've been running devpts_pts on a mainline kernel (4.16+git0+60cc43fc88) and > the verify_invalid_ptmx_bind_mount() test failes with this failure: > > root@intel-core2-32:~# ./devpts_pts > Failed to perform TIOCGPTPEER ioctl > > However, I'm still confused why I'm not able to get the test to pass. Strace > showes that -ENOENT return in the TIOCGPTPEER implementation in the > kernel. I think the -ENOENT gets returned from this path > devpts_mntget()->devpts_ptmx_path->path_pts(). > > See the strace issue below: > root@intel-core2-32:~# strace ./devpts_pts > execve("./devpts_pts", ["./devpts_pts"], [/* 17 vars */]) = 0 > brk(NULL) = 0x5634e0092000 > mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f459d338000 > access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) > open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 > fstat(3, {st_mode=S_IFREG|0644, st_size=16726, ...}) = 0 > mmap(NULL, 16726, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f459d333000 > close(3) = 0 > open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 > read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\3\2\0\0\0\0\0"..., 832) = 832 > fstat(3, {st_mode=S_IFREG|0755, st_size=1681056, ...}) = 0 > mmap(NULL, 3787168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f459cd7b000 > mprotect(0x7f459cf0f000, 2093056, PROT_NONE) = 0 > mmap(0x7f459d10e000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x193000) = 0x7f459d10e000 > mmap(0x7f459d114000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f459d114000 > close(3) = 0 > mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f459d331000 > arch_prctl(ARCH_SET_FS, 0x7f459d331700) = 0 > mprotect(0x7f459d10e000, 16384, PROT_READ) = 0 > mprotect(0x5634debe3000, 4096, PROT_READ) = 0 > mprotect(0x7f459d33a000, 4096, PROT_READ) = 0 > munmap(0x7f459d333000, 16726) = 0 > ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0 > unshare(CLONE_NEWNS) = 0 > mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL) = 0 > mount("/dev/pts/ptmx", "/dev/ptmx", NULL, MS_BIND, NULL) = 0 > open("/dev/ptmx", O_RDWR|O_NOCTTY|O_CLOEXEC) = 3 > ioctl(3, TIOCSPTLCK, [0]) = 0 > ioctl(3, _IOC(0, 0x54, 0x41, 0x00), 0x80102) = 4 > clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f459d3319d0) = 4377 > wait4(4377, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 4377 > --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4377, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- > close(3) = 0 > close(4) = 0 > getpid() = 4376 > open("/tmp/devpts_ptmx_Z6aEvy", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 > mount("/dev/pts/ptmx", "/tmp/devpts_ptmx_Z6aEvy", NULL, MS_BIND, NULL) = 0 > close(3) = 0 > open("/tmp/devpts_ptmx_Z6aEvy", O_RDWR|O_NOCTTY|O_CLOEXEC) = 3 > ioctl(3, TIOCSPTLCK, [0]) = 0 > ioctl(3, _IOC(0, 0x54, 0x41, 0x00), 0x80102) = -1 ENOENT (No such file or directory) > write(2, "Failed to perform TIOCGPTPEER io"..., 36Failed to perform TIOCGPTPEER ioctl > ) = 36 > close(3) = 0 > umount2("/dev/pts", 0) = 0 > umount2("/dev/ptmx", 0) = 0 > mkdir("/tmp/devpts_fs_w22bR6", 0700) = 0 > mount("devpts", "/tmp/devpts_fs_w22bR6", "devpts", MS_NOSUID|MS_NOEXEC, "newinstance,ptmxmode=0666,mode=0"...) = 0 > open("/tmp/devpts_fs_w22bR6/ptmx", O_RDWR|O_NOCTTY|O_CLOEXEC) = 3 > ioctl(3, TIOCSPTLCK, [0]) = 0 > ioctl(3, _IOC(0, 0x54, 0x41, 0x00), 0x80102) = 4 > clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f459d3319d0) = 4378 > wait4(4378, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 4378 > --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4378, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- > close(3) = 0 > close(4) = 0 > unlink("/tmp/devpts_fs_w22bR6") = -1 EISDIR (Is a directory) > exit_group(0) = ? > +++ exited with 0 +++ > root@intel-core2-32:~# > > tools/testing/selftests/filesystems/Makefile | 1 + > tools/testing/selftests/filesystems/devpts_pts.c | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile > index 4e6d09fb166f..427a401aae5c 100644 > --- a/tools/testing/selftests/filesystems/Makefile > +++ b/tools/testing/selftests/filesystems/Makefile > @@ -1,5 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0 > TEST_PROGS := dnotify_test devpts_pts > +CFLAGS += -I../../../../usr/include/ > all: $(TEST_PROGS) > > include ../lib.mk > diff --git a/tools/testing/selftests/filesystems/devpts_pts.c b/tools/testing/selftests/filesystems/devpts_pts.c > index b9055e974289..79420b9d00c7 100644 > --- a/tools/testing/selftests/filesystems/devpts_pts.c > +++ b/tools/testing/selftests/filesystems/devpts_pts.c > @@ -8,7 +8,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > > -- > 2.11.0 >