diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-16 11:49:46 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-16 11:49:46 -0800 |
commit | 571b12dd1ad41f371448b693c0bd2e64968c7af4 (patch) | |
tree | 6d8450241759ed4f8f965eaf24a56facdb1759b1 /include | |
parent | e994cc240a3b75744c33ca9b8d74f71f0fcd8852 (diff) | |
parent | d1df458cbfdb0c3384c03c7fbcb1689bc02a746c (diff) |
Merge tag 'hyperv-next-signed-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull Hyper-V updates from Wei Liu:
- harden VMBus (Andres Beltran)
- clean up VMBus driver (Matheus Castello)
- fix hv_balloon reporting (Vitaly Kuznetsov)
- fix a potential OOB issue (Andrea Parri)
- remove an obsolete TODO item (Stefan Eschenbacher)
* tag 'hyperv-next-signed-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
hv_balloon: do adjust_managed_page_count() when ballooning/un-ballooning
hv_balloon: simplify math in alloc_balloon_pages()
drivers/hv: remove obsolete TODO and fix misleading typo in comment
drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
hv_netvsc: Validate number of allocated sub-channels
drivers: hv: vmbus: Fix call msleep using < 20ms
drivers: hv: vmbus: Fix checkpatch LINE_SPACING
drivers: hv: vmbus: Replace symbolic permissions by octal permissions
drivers: hv: Fix hyperv_record_panic_msg path on comment
hv_netvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening
scsi: storvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening
Drivers: hv: vmbus: Add vmbus_requestor data structure for VMBus hardening
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/hyperv.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 1ce131f29f3b..5ddb479c4d4c 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -764,6 +764,23 @@ enum vmbus_device_type { HV_UNKNOWN, }; +/* + * Provides request ids for VMBus. Encapsulates guest memory + * addresses and stores the next available slot in req_arr + * to generate new ids in constant time. + */ +struct vmbus_requestor { + u64 *req_arr; + unsigned long *req_bitmap; /* is a given slot available? */ + u32 size; + u64 next_request_id; + spinlock_t req_lock; /* provides atomicity */ +}; + +#define VMBUS_NO_RQSTOR U64_MAX +#define VMBUS_RQST_ERROR (U64_MAX - 1) +#define VMBUS_RQST_ID_NO_RESPONSE (U64_MAX - 2) + struct vmbus_device { u16 dev_type; guid_t guid; @@ -988,8 +1005,14 @@ struct vmbus_channel { u32 fuzz_testing_interrupt_delay; u32 fuzz_testing_message_delay; + /* request/transaction ids for VMBus */ + struct vmbus_requestor requestor; + u32 rqstor_size; }; +u64 vmbus_next_request_id(struct vmbus_requestor *rqstor, u64 rqst_addr); +u64 vmbus_request_addr(struct vmbus_requestor *rqstor, u64 trans_id); + static inline bool is_hvsock_channel(const struct vmbus_channel *c) { return !!(c->offermsg.offer.chn_flags & |