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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200910181449.23267.agruen@suse.de>
Date:	Sun, 18 Oct 2009 14:49:22 +0200
From:	Andreas Gruenbacher <agruen@...e.de>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Eric Paris <eparis@...hat.com>
Subject: Re: [BUGFIX] dnotify: handle_event shouldn't match on FS_EVENT_ON_CHILD

Test case demonstrating the bug:


#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

static void create_event(int s, siginfo_t* si, void* p)
{
	printf("create\n");
}

static void delete_event(int s, siginfo_t* si, void* p)
{
	printf("delete\n");
}

int main (void) {
	struct sigaction action;
	char *tmpdir, *file;
	int fd1, fd2;

	sigemptyset (&action.sa_mask);
	action.sa_flags = SA_SIGINFO;

	action.sa_sigaction = create_event;
	sigaction (SIGRTMIN + 0, &action, NULL);

	action.sa_sigaction = delete_event;
	sigaction (SIGRTMIN + 1, &action, NULL);

#	define TMPDIR "/tmp/test.XXXXXX"
	tmpdir = malloc(strlen(TMPDIR) + 1);
	strcpy(tmpdir, TMPDIR);
	mkdtemp(tmpdir);

#	define TMPFILE "file"
	file = malloc(strlen(tmpdir) + strlen(TMPFILE) + 2);
	sprintf(file, "%s/%s", tmpdir, TMPFILE);

	fd1 = open (tmpdir, O_RDONLY);
	fcntl(fd1, F_SETSIG, SIGRTMIN);
	fcntl(fd1, F_NOTIFY, DN_MULTISHOT | DN_CREATE);

	fd2 = open (tmpdir, O_RDONLY);
	fcntl(fd2, F_SETSIG, SIGRTMIN + 1);
	fcntl(fd2, F_NOTIFY, DN_MULTISHOT | DN_DELETE);

	if (fork()) {
		creat(file, 0600);

		/* Spurious event triggered below! */

		unlink(file);
	} else {
		sleep(1);
		rmdir(tmpdir);
	}

	return 0;
}
--
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