All of lore.kernel.org
 help / color / mirror / Atom feed
* avc_open() and netlink_loop()
@ 2010-02-03  6:19 KaiGai Kohei
  2010-02-26 19:14 ` Eamon Walsh
  0 siblings, 1 reply; 8+ messages in thread
From: KaiGai Kohei @ 2010-02-03  6:19 UTC (permalink / raw)
  To: Eamon Walsh; +Cc: selinux

When we initialize userspace avc using avc_open(3), it internally calls
avc_init(3) without any callback functions. The avc_init() is introduced
as a deprecated interface from application code, so it is recommended to
use avc_open() instead for new applications.

The avc_init() internally calls avc_netlink_open(). If no thread callback
is not given, the 'blocking' argument shall be 0, then avc_netlink_open()
set O_NONBLOCK flag on the socket file descriptor.

Next, application will create a thread to receive messages via netlink
socket to invalidate userspace avc, using avc_netlink_loop().
However, if userspace avc of libselinux is already initialized,
the avc_netlink_loop() immediately returns with EWOULDBLOCK, because the
netlink socket is not blocked and avc_netlink_receive() does not expect
recvfrom() returns error.

It seems to me O_NONBLOCK is a wrong strategy in this case, and select(2)
should be checked in avc_netlink_check_nb() instead.

Eamon, what is your opinion?
-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-03-08 23:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03  6:19 avc_open() and netlink_loop() KaiGai Kohei
2010-02-26 19:14 ` Eamon Walsh
2010-02-26 20:49   ` Eamon Walsh
2010-02-26 20:56     ` [PATCH] libselinux: fix avc_netlink_loop() error caused by nonblocking mode Eamon Walsh
2010-03-02  2:48       ` KaiGai Kohei
2010-03-02 17:29         ` Eamon Walsh
2010-03-03  0:30           ` KaiGai Kohei
2010-03-08 23:19             ` Eamon Walsh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.