Linus Torvalds
bf4afc53b7
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
...
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2026-02-21 17:09:51 -08:00
Kees Cook
69050f8d6d
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
...
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org >
2026-02-21 01:02:28 -08:00
Ingo Molnar and Thomas Gleixner
41cb08555c
treewide, timers: Rename from_timer() to timer_container_of()
...
Move this API to the canonical timer_*() namespace.
[ tglx: Redone against pre rc1 ]
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-06-08 09:07:37 +02:00
Thomas Gleixner and Ingo Molnar
8fa7292fee
treewide: Switch/rename to timer_delete[_sync]()
...
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.
Conversion was done with coccinelle plus manual fixups where necessary.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2025-04-05 10:30:12 +02:00
Arnd Bergmann and Greg Kroah-Hartman
c99e1e1d08
vbox: add HAS_IOPORT dependency
...
The vboxguest driver depends on port I/O for debug output:
include/asm-generic/io.h:626:15: error: call to '_outl' declared with attribute error: outl() requires CONFIG_HAS_IOPORT
626 | #define _outl _outl
include/asm-generic/io.h:663:14: note: in expansion of macro '_outl'
663 | #define outl _outl
| ^~~~~
drivers/virt/vboxguest/vboxguest_utils.c:102:9: note: in expansion of macro 'outl'
102 | outl(phys_req, gdev->io_port + VMMDEV_PORT_OFF_REQUEST);
| ^~~~
Most arm64 platforms don't actually support port I/O, though it is
currently enabled unconditionally. Refine the vbox dependency to allow
turning HAS_IOPORT off in the future when building for platforms without
port I/O and allow compile-testing on all architectures.
Fixes: 5cf8f938bf ("vbox: Enable VBOXGUEST and VBOXSF_FS on ARM64")
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20250122065445.1469218-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-02-20 15:19:27 +01:00
Christian Kujau and Christian Brauner
5cf8f938bf
vbox: Enable VBOXGUEST and VBOXSF_FS on ARM64
...
Now that VirtualBox is able to run as a host on arm64 (e.g. the Apple M3
processors) we can enable VBOXSF_FS (and in turn VBOXGUEST) for this
architecture. Tested with various runs of bonnie++ and dbench on an Apple
MacBook Pro with the latest Virtualbox 7.1.4 r165100 installed.
Signed-off-by: Christian Kujau <lists@nerdbynature.de >
Link: https://lore.kernel.org/r/7384d96c-2a77-39b0-2306-90129bae9342@nerdbynature.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Christian Brauner <brauner@kernel.org >
2025-01-07 15:57:23 +01:00
Randy Dunlap and Greg Kroah-Hartman
c9d98a562c
virt: vbox: utils: fix all kernel-doc warnings
...
Use kernel-doc format for functions that have comments that begin
with "/**".
This prevents 6 kernel-doc warnings.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Hans de Goede <hdegoede@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20231222052521.14333-3-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-12-23 14:15:46 +01:00
Randy Dunlap and Greg Kroah-Hartman
2fd34a5d1d
virt: vbox: linux: fix all kernel-doc warnings
...
Use kernel-doc format for functions that are almost complete in their
kernel-doc comments.
For other functions, just change the comment to a common C comment.
This prevents 7 kernel-doc warnings.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Hans de Goede <hdegoede@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20231222052521.14333-2-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-12-23 14:15:45 +01:00
Randy Dunlap and Greg Kroah-Hartman
8974a86d1e
virt: vbox: core: fix all kernel-doc warnings
...
Use kernel-doc format for functions that have comments that begin
with "/**".
This prevents 26 kernel-doc warnings.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Hans de Goede <hdegoede@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20231222052521.14333-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-12-23 14:15:45 +01:00
Jiasheng Jiang and Greg Kroah-Hartman
2699e6e9e9
virt: vbox: Remove unproper information
...
When drivers are working properly, they are quiet.
Therefore, the vbg_info() should be removed.
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn >
Link: https://lore.kernel.org/r/20220901144619.3550352-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-09 10:19:18 +02:00
Jiasheng Jiang and Greg Kroah-Hartman
d4d2c58bdb
virt: vbox: convert to use dev_groups
...
The driver core supports the ability to handle the creation and removal
of device-specific sysfs files in a race-free manner. Moreover, it can
guarantee the success of creation. Therefore, it should be better to
convert to use dev_groups.
Fixes: 0ba002bc43 ("virt: Add vboxguest driver for Virtual Box Guest integration")
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn >
Link: https://lore.kernel.org/r/20220901144610.3550300-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-09 10:19:04 +02:00
Wolfram Sang and Greg Kroah-Hartman
d8baf6ca8c
virt: move from strlcpy with unused retval to strscpy
...
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.
Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20220818210120.7565-1-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-01 16:29:46 +02:00
Pascal Terjan and Greg Kroah-Hartman
6169525b76
vboxguest: Do not use devm for irq
...
When relying on devm it doesn't get freed early enough which causes the
following warning when unloading the module:
[249348.837181] remove_proc_entry: removing non-empty directory 'irq/20', leaking at least 'vboxguest'
[249348.837219] WARNING: CPU: 0 PID: 6708 at fs/proc/generic.c:715 remove_proc_entry+0x119/0x140
[249348.837379] Call Trace:
[249348.837385] unregister_irq_proc+0xbd/0xe0
[249348.837392] free_desc+0x23/0x60
[249348.837396] irq_free_descs+0x4a/0x70
[249348.837401] irq_domain_free_irqs+0x160/0x1a0
[249348.837452] mp_unmap_irq+0x5c/0x60
[249348.837458] acpi_unregister_gsi_ioapic+0x29/0x40
[249348.837463] acpi_unregister_gsi+0x17/0x30
[249348.837467] acpi_pci_irq_disable+0xbf/0xe0
[249348.837473] pcibios_disable_device+0x20/0x30
[249348.837478] pci_disable_device+0xef/0x120
[249348.837482] vbg_pci_remove+0x6c/0x70 [vboxguest]
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Pascal Terjan <pterjan@google.com >
Link: https://lore.kernel.org/r/20220612133744.4030602-1-pterjan@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-06-27 16:16:03 +02:00
Hans de Goede and Greg Kroah-Hartman
c35901b39d
virt: vbox: Do not use wait_event_interruptible when called from kernel context
...
Do not use wait_event_interruptible when vbg_hgcm_call() gets called from
kernel-context, such as it being called by the vboxsf filesystem code.
This fixes some filesystem related system calls on shared folders
unexpectedly failing with -EINTR.
Fixes: 0532a1b0d0 ("virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x")
Reported-by: Ludovic Pouzenc <bugreports@pouzenc.fr >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Cc: stable <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20210121150754.147598-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-01-27 14:37:02 +01:00
Qinglang Miao and Greg Kroah-Hartman
03c95e591a
virt: vbox: simplify the return expression of vbg_input_open()
...
Simplify the return expression.
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com >
Link: https://lore.kernel.org/r/20200921131113.93459-1-miaoqinglang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-02 11:36:13 +02:00
Denis Efremov and Greg Kroah-Hartman
da0d6b3a53
virt: vbox: Use current_uid() in vbg_misc_device_requestor()
...
Modify vbg_misc_device_requestor() to use current_uid() wrapper.
Signed-off-by: Denis Efremov <efremov@linux.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200824125330.487083-1-efremov@linux.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-08-28 12:22:50 +02:00
Hans de Goede and Greg Kroah-Hartman
729082ed9b
virt: vbox: Fix some comments which talk about the "session spinlock"
...
The session lock is a mutex, not a spinlock, fix the comments to match.
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-9-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
5bc117a27f
virt: vbox: Log unknown ioctl requests as error
...
Every now and then upstream adds new ioctls without notifying us,
log unknown ioctl requests as an error to catch these.
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-8-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
316b003540
virt: vbox: Add a few new vmmdev request types to the userspace whitelist
...
Upstream VirtualBox has defined and is using a few new request types for
vmmdev requests passed through /dev/vboxguest to the hypervisor.
Add the defines for these to vbox_vmmdev_types.h and add add them to the
whitelists of vmmdev requests which userspace is allowed to make.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1789545
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-7-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
631beddc54
virt: vbox: Add support for the new VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES ioctl
...
Add support for the new VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES ioctl, this
is necessary for automatic resizing of the guest resolution to match the
VM-window size to work with the new VMSVGA virtual GPU which is now the
new default in VirtualBox.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1789545
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-6-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
412f84cff0
virt: vbox: Add vbg_set_host_capabilities() helper function
...
Add vbg_set_host_capabilities() helper function, this is a preparation
patch for adding support for the VBGL_IOCTL_GUEST_CAPS_ACQUIRE ioctl.
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-5-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
fd01cc5903
virt: vbox: Rename guest_caps struct members to set_guest_caps
...
Rename guest_caps[_tracker] struct members to set_guest_caps[_tracker]
this is a preparation patch for adding support for the
VBGL_IOCTL_GUEST_CAPS_ACQUIRE ioctl.
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-4-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:45:32 +02:00
Hans de Goede and Greg Kroah-Hartman
59d1d2e8e1
virt: vbox: Fix guest capabilities mask check
...
Check the passed in capabilities against VMMDEV_GUEST_CAPABILITIES_MASK
instead of against VMMDEV_EVENT_VALID_EVENT_MASK.
This tightens the allowed mask from 0x7ff to 0x7.
Fixes: 0ba002bc43 ("virt: Add vboxguest driver for Virtual Box Guest integration")
Cc: stable@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-3-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:40:19 +02:00
Hans de Goede and Greg Kroah-Hartman
f794db6841
virt: vbox: Fix VBGL_IOCTL_VMMDEV_REQUEST_BIG and _LOG req numbers to match upstream
...
Until this commit the mainline kernel version (this version) of the
vboxguest module contained a bug where it defined
VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG using
_IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead of
_IO(V, ...) as the out of tree VirtualBox upstream version does.
Since the VirtualBox userspace bits are always built against VirtualBox
upstream's headers, this means that so far the mainline kernel version
of the vboxguest module has been failing these 2 ioctls with -ENOTTY.
I guess that VBGL_IOCTL_VMMDEV_REQUEST_BIG is never used causing us to
not hit that one and sofar the vboxguest driver has failed to actually
log any log messages passed it through VBGL_IOCTL_LOG.
This commit changes the VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG
defines to match the out of tree VirtualBox upstream vboxguest version,
while keeping compatibility with the old wrong request defines so as
to not break the kernel ABI in case someone has been using the old
request defines.
Fixes: f6ddd094f5 ("virt: Add vboxguest driver for Virtual Box Guest integration UAPI")
Cc: stable@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20200709120858.63928-2-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:40:19 +02:00
Joe Perches and Greg Kroah-Hartman
87292bca01
virt: vbox: Use fallthrough;
...
Convert the various uses of fallthrough comments to fallthrough;
Done via script
Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe@perches.com/
And by hand:
drivers/virt/vboxguest/vboxguest_core.c has a fallthrough comment outside
of an #ifdef block that causes gcc to emit a warning if converted in-place.
So move the new fallthrough; inside the containing #ifdef/#endif too.
Signed-off-by: Joe Perches <joe@perches.com >
Acked-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/68773b4cd82288b78ca6fcde8c43e249a025378a.1584040050.git.joe@perches.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-19 07:41:03 +01:00