lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CALCETrUJHDHcB8TEYOBfbOp=xSZYzghiTtMxsDr9rhV0eUJj=A@mail.gmail.com>
Date:	Thu, 1 Aug 2013 18:51:33 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	linux-kernel@...r.kernel.org,
	Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: O_TMPFILE and linkat(/proc/self/fd/...) on tmpfs creates a weird file

This test program:

#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>

#define __O_TMPFILE 020000000
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define AT_EMPTY_PATH 0x1000

int main(int argc, char **argv)
{
  char buf[128];

  if (argc != 3)
    errx(1, "Usage: flinktest PATH linkat|proc");

  int fd = open(".", O_TMPFILE | O_RDWR);
  if (fd == -1)
    err(1, "O_TMPFILE");
  write(fd, "test", 4);

  if (!strcmp(argv[2], "linkat")) {
    if (linkat(fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) != 0)
      err(1, "linkat");
  } else if (!strcmp(argv[2], "proc")) {
    sprintf(buf, "/proc/self/fd/%d", fd);
    if (linkat(AT_FDCWD, buf, AT_FDCWD, argv[1], AT_SYMLINK_FOLLOW) != 0)
      err(1, "linkat");
  } else {
    errx(1, "invalid mode");
  }
  return 0;
}


run on tmpfs results in a "weird file".   stat thinks it has "Access:
(0000/?--------) and cat says "Invalid argument".

This is on -linus from a couple minutes ago.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ