diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-08-22 06:50:18 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-09-22 21:07:24 +0200 |
commit | b855f8d175a0a26c9798cbc5962bb8c0d9538231 (patch) | |
tree | 06ef9b853e3700eb33aaccd9ffba4c0922baaf42 /scsi/pr-helper.h | |
parent | 7c9e527659c67d4d7b41d9504f93d2d7ee482488 (diff) |
scsi: build qemu-pr-helper
Introduce a privileged helper to run persistent reservation commands.
This lets virtual machines send persistent reservations without using
CAP_SYS_RAWIO or out-of-tree patches. The helper uses Unix permissions
and SCM_RIGHTS to restrict access to processes that can access its socket
and prove that they have an open file descriptor for a raw SCSI device.
The next patch will also correct the usage of persistent reservations
with multipath devices.
It would also be possible to support for Linux's IOC_PR_* ioctls in
the future, to support NVMe devices. For now, however, only SCSI is
supported.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scsi/pr-helper.h')
-rw-r--r-- | scsi/pr-helper.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scsi/pr-helper.h b/scsi/pr-helper.h new file mode 100644 index 0000000000..96c50a9e5f --- /dev/null +++ b/scsi/pr-helper.h @@ -0,0 +1,41 @@ +/* Definitions for QEMU's persistent reservation helper daemon + * + * Copyright (C) 2017 Red Hat, Inc. + * + * Author: + * Paolo Bonzini <pbonzini@redhat.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#ifndef QEMU_PR_HELPER_H +#define QEMU_PR_HELPER_H 1 + +#include <stdint.h> + +#define PR_HELPER_CDB_SIZE 16 +#define PR_HELPER_SENSE_SIZE 96 +#define PR_HELPER_DATA_SIZE 8192 + +typedef struct PRHelperResponse { + int32_t result; + int32_t sz; + uint8_t sense[PR_HELPER_SENSE_SIZE]; +} PRHelperResponse; + +#endif |