mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 14:02:06 -04:00
connector/cn_proc: Add filtering to fix some bugs
The current proc connector code has the foll. bugs - if there are more than one listeners for the proc connector messages, and one of them deregisters for listening using PROC_CN_MCAST_IGNORE, they will still get all proc connector messages, as long as there is another listener. Another issue is if one client calls PROC_CN_MCAST_LISTEN, and another one calls PROC_CN_MCAST_IGNORE, then both will end up not getting any messages. This patch adds filtering and drops packet if client has sent PROC_CN_MCAST_IGNORE. This data is stored in the client socket's sk_user_data. In addition, we only increment or decrement proc_event_num_listeners once per client. This fixes the above issues. cn_release is the release function added for NETLINK_CONNECTOR. It uses the newly added netlink_release function added to netlink_sock. It will free sk_user_data. Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a4c9a56e6a
commit
2aa1f7a1f4
@@ -30,6 +30,30 @@ enum proc_cn_mcast_op {
|
||||
PROC_CN_MCAST_IGNORE = 2
|
||||
};
|
||||
|
||||
enum proc_cn_event {
|
||||
/* Use successive bits so the enums can be used to record
|
||||
* sets of events as well
|
||||
*/
|
||||
PROC_EVENT_NONE = 0x00000000,
|
||||
PROC_EVENT_FORK = 0x00000001,
|
||||
PROC_EVENT_EXEC = 0x00000002,
|
||||
PROC_EVENT_UID = 0x00000004,
|
||||
PROC_EVENT_GID = 0x00000040,
|
||||
PROC_EVENT_SID = 0x00000080,
|
||||
PROC_EVENT_PTRACE = 0x00000100,
|
||||
PROC_EVENT_COMM = 0x00000200,
|
||||
/* "next" should be 0x00000400 */
|
||||
/* "last" is the last process event: exit,
|
||||
* while "next to last" is coredumping event
|
||||
*/
|
||||
PROC_EVENT_COREDUMP = 0x40000000,
|
||||
PROC_EVENT_EXIT = 0x80000000
|
||||
};
|
||||
|
||||
struct proc_input {
|
||||
enum proc_cn_mcast_op mcast_op;
|
||||
};
|
||||
|
||||
/*
|
||||
* From the user's point of view, the process
|
||||
* ID is the thread group ID and thread ID is the internal
|
||||
@@ -44,24 +68,7 @@ enum proc_cn_mcast_op {
|
||||
*/
|
||||
|
||||
struct proc_event {
|
||||
enum what {
|
||||
/* Use successive bits so the enums can be used to record
|
||||
* sets of events as well
|
||||
*/
|
||||
PROC_EVENT_NONE = 0x00000000,
|
||||
PROC_EVENT_FORK = 0x00000001,
|
||||
PROC_EVENT_EXEC = 0x00000002,
|
||||
PROC_EVENT_UID = 0x00000004,
|
||||
PROC_EVENT_GID = 0x00000040,
|
||||
PROC_EVENT_SID = 0x00000080,
|
||||
PROC_EVENT_PTRACE = 0x00000100,
|
||||
PROC_EVENT_COMM = 0x00000200,
|
||||
/* "next" should be 0x00000400 */
|
||||
/* "last" is the last process event: exit,
|
||||
* while "next to last" is coredumping event */
|
||||
PROC_EVENT_COREDUMP = 0x40000000,
|
||||
PROC_EVENT_EXIT = 0x80000000
|
||||
} what;
|
||||
enum proc_cn_event what;
|
||||
__u32 cpu;
|
||||
__u64 __attribute__((aligned(8))) timestamp_ns;
|
||||
/* Number of nano seconds since system boot */
|
||||
|
||||
Reference in New Issue
Block a user