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: <Pine.LNX.4.44L0.1304011352420.1036-100000@iolanthe.rowland.org>
Date:	Mon, 1 Apr 2013 14:08:32 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Theodore Ts'o <tytso@...m.mit.edu>
cc:	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Files are created with the wrong permissions

Ted or anybody else:

In preparation for a software upgrade, I just repartitioned and
reformmated my server.  After restoring the contents from a backup and
booting, I find that new files are not being created with the right
permissions, which obviously causes lots of problems.

Here's an example of a simple test program:


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

int main()
{
	unsigned	m;
	int		fd;

	m = umask(0);
	printf("Original umask: %03o\n", m);

	fd = open("b", O_RDWR | O_CREAT | O_EXCL, 0777);
	printf("fd: %d\n", fd);
	if (fd != -1)
		close(fd);

	return 0;
}


Since the umask is set to 0, the "b" file should be created with its 
permissions set to -rwxrwxrwx.  That's not what happens.

The results vary as I run the program in different directories.  For
example, running as root in /root, I get:

	-r-xr-x--- 1 root root 0 Apr  1 13:56 b

But in /var, I get:

	-rwxr-xr-x 1 root root 0 Apr  1 14:05 b

In other places I get:

	-rwx------ 1 root root 0 Apr  1 13:57 b

or

	-rwxr-x--- 1 root root 0 Apr  1 14:00 b

or

	-rwxr-xr-x 1 root root 0 Apr  1 13:58 b

or even the expected result:

	-rwxrwxrwx 1 root root 0 Apr  1 13:42 b

Can anybody suggest the reason for this and how to fix it?

One fact that might be relevant: The original filesystems were ext3, 
but I reformatted the partitions as ext4.  The restore was done using 
tar with the --xattrs option.  Could that be responsible?  lsattr shows 
only:

# lsattr -d /root
-------------e- /root

Note: This happens under both the 3.6 and 3.8 kernels.

Thanks for any help.

Alan Stern

--
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