static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
- return sys_aio_read(aiocb);
+ int ret;
+ /*
+ * aio_read must be done as root, because in the glibc aio
+ * implementation the helper thread needs to be able to send a signal
+ * to the main thread, even when it has done a seteuid() to a
+ * different user.
+ */
+ become_root();
+ ret = sys_aio_read(aiocb);
+ unbecome_root();
+ return ret;
}
static int vfswrap_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
- return sys_aio_write(aiocb);
+ int ret;
+ /*
+ * aio_write must be done as root, because in the glibc aio
+ * implementation the helper thread needs to be able to send a signal
+ * to the main thread, even when it has done a seteuid() to a
+ * different user.
+ */
+ become_root();
+ ret = sys_aio_write(aiocb);
+ unbecome_root();
+ return ret;
}
static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = req->mid;
- become_root();
ret = SMB_VFS_AIO_READ(fsp, a);
- unbecome_root();
-
if (ret == -1) {
DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
"Error %s\n", strerror(errno) ));
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = req->mid;
- become_root();
ret = SMB_VFS_AIO_WRITE(fsp, a);
- unbecome_root();
-
if (ret == -1) {
DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
"Error %s\n", strerror(errno) ));