From nobody Wed Jun 21 08:17:09 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QmGZG4DNCz4g0t3 for ; Wed, 21 Jun 2023 08:17:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QmGZF5zq3z44hJ for ; Wed, 21 Jun 2023 08:17:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687335429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iRD5Y56/ThcW/8bdzt1+ZLr2pzkr1IpuvzhidBwxWts=; b=CFm+D8GtA0mimfceSeolElBwkjMWVv5OBHaN6p6/vM4mV3lZSUc42rm69DqtPL7F7KQesm jibTOOv2z0W3GxfPbxAuRWVGqgU02a7ooCv9V5f4Iq07bBHAytntFqpaSESTKblOmpX7Li wZAG0OQzJZBwWtINiKjEGjnRWM7NGN3dOqgOJaWhXScypgQ2M6EJTD48DDfmEsQxZqksBf DefCrDbtCa29CRnefH7Hw/FxYHHs9NOJgVCoHM5+m3tikeDz+cPWuGsiXf1zJ2W6lNV0aR wZv/3rykS1z0FeaiAE/J+2xEzAmNlGTCZbwfdZCXkO98w5KZiMzC4YAo1Y4eRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687335429; a=rsa-sha256; cv=none; b=BHZAr4MsA5PE63pNYJTJN0454Yg54kR23VTabVGgaoFtqc525wQx4I3wi4FaCRJbWR13Y4 y+rUd7xk5jbuvSXfXcqEaF35u4kfoNqPhEDBb2A9ROce0o1Do5ZuCRsunyFG5TBDwhDvaG 1kNTFIvIh1Jw12xo1Qie//xsSCn+uFPYgpKCiTux6XN1mWvU/jdOXXP4XM3xio8D4NBOiK 6XAiLWSK9xOJjFJSLuRU04Yi50sfLrpI0VgS9hcTS5i52UOII0xrmz8FcWGq9r3gC+VH4y STjzRP8X7VKVRcclM2EnlW6kL6gq8ba0Jju6fztwnbTGh3xtYntXEmQ8tBCuCQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QmGZF4TwWzYqj for ; Wed, 21 Jun 2023 08:17:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 35L8H9hq029900 for ; Wed, 21 Jun 2023 08:17:09 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35L8H9Pe029899 for bugs@FreeBSD.org; Wed, 21 Jun 2023 08:17:09 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272127] fdescfs with linkrdlnk fails openat with O_DIRECTORY unless "ls -l" done in fdescfs dir first... Date: Wed, 21 Jun 2023 08:17:09 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pen@lysator.liu.se X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272127 Bug ID: 272127 Summary: fdescfs with linkrdlnk fails openat with O_DIRECTORY unless "ls -l" done in fdescfs dir first... Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: pen@lysator.liu.se Seems like the kernel doesn't follow the fdescfs symlink when checking if t= he target points to a directory for openat (and open) with the O_DIRECTORY fla= g.=20 Unless you've primed it with an "ls -l" in the directory (or something simi= lar that does a stat() call). Then it starts to work. To "reset" - unmount and remount the fdescfs filesystem again (Thought I was going insane when debugging a problem with Samba 4.18 and Sa= mba failed but my test program worked. Turned out my test program was doing a stat() call before attempting this which primed the cache...) root@runur00:~ # egrep compat /etc/fstab none /compat/linux/dev/fd fdescfs rw,linrdlnk 0=20=20=20= =20=20=20=20 root@runur00:~ # ./t ./t: openat(AT_FDCWD, "/compat/linux/dev/fd/3", O_DIRECTORY, 0): Not a directory root@runur00:~ # ls /compat/linux/dev/fd/ 0 1 2 3 4 root@runur00:~ # ./t ./t: openat(AT_FDCWD, "/compat/linux/dev/fd/3", O_DIRECTORY, 0): Not a directory root@runur00:~ # ls -l /compat/linux/dev/fd/ total 0 lr-xr-xr-x 1 root wheel 0 Jun 20 15:57 0 -> /dev/pts/0 lr-xr-xr-x 1 root wheel 0 Jun 20 15:57 1 -> /dev/pts/0 lr-xr-xr-x 1 root wheel 0 Jun 20 15:57 2 -> /dev/pts/0 lr-xr-xr-x 1 root wheel 0 Jun 20 15:57 3 -> /root lr-xr-xr-x 1 root wheel 0 Jun 20 15:57 4 -> /etc/spwd.db root@runur00:~ # ./t /compat/linux/dev/fd/3: OK root@runur00:~ # umount /compat/linux/dev/fd root@runur00:~ # mount /compat/linux/dev/fd root@runur00:~ # ./t ./t: openat(AT_FDCWD, "/compat/linux/dev/fd/3", O_DIRECTORY, 0): Not a directory Test program: #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int dfd, tfd; char buf[2048]; dfd =3D open(".", O_PATH); sprintf(buf, "/compat/linux/dev/fd/%d", dfd); tfd =3D openat(AT_FDCWD, buf, O_DIRECTORY, 0); if (tfd < 0) { fprintf(stderr, "%s: openat(AT_FDCWD, \"%s\", O_DIRECTORY, 0): %s\n", argv[0], buf, strerror(errno)); exit(1); } printf("%s: OK\n", buf); exit(0); } --=20 You are receiving this mail because: You are the assignee for the bug.=