mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@redhat.com>
To: Neil Horman <nhorman@redhat.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Patch][RFC] fcntl: add ability to stop monitored processes
Date: Sun, 12 Jun 2005 14:10:06 -0400	[thread overview]
Message-ID: <20050612181006.GC2229@hmsendeavour.rdu.redhat.com> (raw)
In-Reply-To: <20050611193500.GC1097@devserv.devel.redhat.com>

How about this?  Its the same feature, with an added check in fcntl_dirnotify to
ensure that only processes with CAP_SYS_ADMIN set can tell processes preforming
the monitored actions to stop.

Signed-off-by: Neil Horman <nhorman@redhat.com>


 fs/dnotify.c          |    4 ++++
 fs/fcntl.c            |    1 +
 include/linux/fcntl.h |    1 +
 3 files changed, 6 insertions(+)


--- linux-2.6/include/linux/fcntl.h.orig	2005-06-10 16:04:48.000000000 -0400
+++ linux-2.6/include/linux/fcntl.h	2005-06-10 16:02:16.000000000 -0400
@@ -21,6 +21,7 @@
 #define DN_DELETE	0x00000008	/* File removed */
 #define DN_RENAME	0x00000010	/* File renamed */
 #define DN_ATTRIB	0x00000020	/* File changed attibutes */
+#define DN_STOPSND	0x40000000	/* Send a SIGSTOP to the sender */
 #define DN_MULTISHOT	0x80000000	/* Don't remove notifier */
 
 #ifdef __KERNEL__
--- linux-2.6/fs/dnotify.c.orig	2005-05-04 21:47:58.000000000 -0400
+++ linux-2.6/fs/dnotify.c	2005-06-11 21:27:37.000000000 -0400
@@ -74,6 +74,8 @@ int fcntl_dirnotify(int fd, struct file 
 	}
 	if (!dir_notify_enable)
 		return -EINVAL;
+	if(!capable(CAP_SYS_ADMIN) && (arg & DN_STOPSND))
+		return -EPERM;
 	inode = filp->f_dentry->d_inode;
 	if (!S_ISDIR(inode->i_mode))
 		return -ENOTDIR;
@@ -138,6 +140,8 @@ void __inode_dir_notify(struct inode *in
 			changed = 1;
 			kmem_cache_free(dn_cache, dn);
 		}
+		if (dn->dn_mask & DN_STOPSND)
+			send_sig(SIGSTOP,current,1);
 	}
 	if (changed)
 		redo_inode_mask(inode);
--- linux-2.6/fs/fcntl.c.orig	2005-05-04 21:47:58.000000000 -0400
+++ linux-2.6/fs/fcntl.c	2005-06-10 16:05:17.000000000 -0400
@@ -438,6 +438,7 @@ static void send_sigio_to_task(struct ta
 			else
 				si.si_band = band_table[reason - POLL_IN];
 			si.si_fd    = fd;
+			si.si_pid   = current->pid;
 			if (!send_group_sig_info(fown->signum, &si, p))
 				break;
 		/* fall-through: fall back on the old plain SIGIO signal */
-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@redhat.com
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

  reply	other threads:[~2005-06-12 19:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-11  0:05 Neil Horman
2005-06-11 18:07 ` Matthew Wilcox
2005-06-11 19:35   ` Neil Horman
2005-06-12 18:10     ` Neil Horman [this message]
2005-06-13  6:13       ` Arjan van de Ven
2005-06-13 13:48         ` Neil Horman
2005-06-13 14:03           ` Alan Cox
2005-06-13 15:12             ` Neil Horman
2005-06-13 13:42       ` Alan Cox
2005-06-13 13:50         ` Neil Horman
2005-06-13 15:10           ` Alan Cox
2005-06-13 15:22             ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050612181006.GC2229@hmsendeavour.rdu.redhat.com \
    --to=nhorman@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®