Commit 64e85168 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'uml-for-linus-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull UML updates from Richard Weinberger:

 - Add support for rust (yay!)

 - Add support for LTO

 - Add platform bus support to virtio-pci

 - Various virtio fixes

 - Coding style, spelling cleanups

* tag 'uml-for-linus-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (27 commits)
  Documentation: rust: Fix arch support table
  uml: vector: Remove unused definitions VECTOR_{WRITE,HEADERS}
  um: virt-pci: properly remove PCI device from bus
  um: virtio_uml: move device breaking into workqueue
  um: virtio_uml: mark device as unregistered when breaking it
  um: virtio_uml: free command if adding to virtqueue failed
  UML: define RUNTIME_DISCARD_EXIT
  virt-pci: add platform bus support
  um-virt-pci: Make max delay configurable
  um: virt-pci: implement pcibios_get_phb_of_node()
  um: Support LTO
  um: put power options in a menu
  um: Use CFLAGS_vmlinux
  um: Prevent building modules incompatible with MODVERSIONS
  um: Avoid pcap multiple definition errors
  um: Make the definition of cpu_data more compatible
  x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list
  rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  rust: arch/um: Disable FP/SIMD instruction to match x86
  rust: arch/um: Use 'pie' relocation mode under UML
  ...
parents e31b283a 04df97e1
...@@ -16,4 +16,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file. ...@@ -16,4 +16,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file.
Architecture Level of support Constraints Architecture Level of support Constraints
============ ================ ============================================== ============ ================ ==============================================
``x86`` Maintained ``x86_64`` only. ``x86`` Maintained ``x86_64`` only.
``um`` Maintained ``x86_64`` only.
============ ================ ============================================== ============ ================ ==============================================
...@@ -25,9 +25,12 @@ config UML ...@@ -25,9 +25,12 @@ config UML
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES select GENERIC_CPU_DEVICES
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select ARCH_SUPPORTS_LTO_CLANG
select ARCH_SUPPORTS_LTO_CLANG_THIN
select TRACE_IRQFLAGS_SUPPORT select TRACE_IRQFLAGS_SUPPORT
select TTY # Needed for line.c select TTY # Needed for line.c
select HAVE_ARCH_VMAP_STACK select HAVE_ARCH_VMAP_STACK
select HAVE_RUST if X86_64
config MMU config MMU
bool bool
...@@ -242,4 +245,8 @@ source "arch/um/drivers/Kconfig" ...@@ -242,4 +245,8 @@ source "arch/um/drivers/Kconfig"
config ARCH_SUSPEND_POSSIBLE config ARCH_SUSPEND_POSSIBLE
def_bool y def_bool y
menu "Power management options"
source "kernel/power/Kconfig" source "kernel/power/Kconfig"
endmenu
...@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \ ...@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
-Din6addr_loopback=kernel_in6addr_loopback \ -Din6addr_loopback=kernel_in6addr_loopback \
-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
KBUILD_RUSTFLAGS += -Crelocation-model=pie
KBUILD_AFLAGS += $(ARCH_INCLUDE) KBUILD_AFLAGS += $(ARCH_INCLUDE)
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
...@@ -139,11 +141,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y) ...@@ -139,11 +141,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y)
LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments) LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
endif endif
LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
# Used by link-vmlinux.sh which has special support for um link # Used by link-vmlinux.sh which has special support for um link
export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) $(CC_FLAGS_LTO)
export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
# When cleaning we don't include .config, so we don't include # When cleaning we don't include .config, so we don't include
# TT or skas makefiles and don't clean skas_ptregs.h. # TT or skas makefiles and don't clean skas_ptregs.h.
......
...@@ -261,6 +261,7 @@ config UML_NET_VECTOR ...@@ -261,6 +261,7 @@ config UML_NET_VECTOR
config UML_NET_VDE config UML_NET_VDE
bool "VDE transport (obsolete)" bool "VDE transport (obsolete)"
depends on UML_NET depends on UML_NET
depends on !MODVERSIONS
select MAY_HAVE_RUNTIME_DEPS select MAY_HAVE_RUNTIME_DEPS
help help
This User-Mode Linux network transport allows one or more running This User-Mode Linux network transport allows one or more running
...@@ -309,6 +310,7 @@ config UML_NET_MCAST ...@@ -309,6 +310,7 @@ config UML_NET_MCAST
config UML_NET_PCAP config UML_NET_PCAP
bool "pcap transport (obsolete)" bool "pcap transport (obsolete)"
depends on UML_NET depends on UML_NET
depends on !MODVERSIONS
select MAY_HAVE_RUNTIME_DEPS select MAY_HAVE_RUNTIME_DEPS
help help
The pcap transport makes a pcap packet stream on the host look The pcap transport makes a pcap packet stream on the host look
......
...@@ -15,7 +15,7 @@ struct pcap_init { ...@@ -15,7 +15,7 @@ struct pcap_init {
char *filter; char *filter;
}; };
void pcap_init(struct net_device *dev, void *data) void pcap_init_kern(struct net_device *dev, void *data)
{ {
struct uml_net_private *pri; struct uml_net_private *pri;
struct pcap_data *ppri; struct pcap_data *ppri;
...@@ -44,7 +44,7 @@ static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp) ...@@ -44,7 +44,7 @@ static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
} }
static const struct net_kern_info pcap_kern_info = { static const struct net_kern_info pcap_kern_info = {
.init = pcap_init, .init = pcap_init_kern,
.protocol = eth_protocol, .protocol = eth_protocol,
.read = pcap_read, .read = pcap_read,
.write = pcap_write, .write = pcap_write,
......
...@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out) ...@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
if (parsed == NULL) { if (parsed == NULL) {
*error_out = "vector_config failed to parse parameters"; *error_out = "vector_config failed to parse parameters";
kfree(params);
return -EINVAL; return -EINVAL;
} }
......
...@@ -68,8 +68,6 @@ struct vector_fds { ...@@ -68,8 +68,6 @@ struct vector_fds {
}; };
#define VECTOR_READ 1 #define VECTOR_READ 1
#define VECTOR_WRITE (1 < 1)
#define VECTOR_HEADERS (1 < 2)
extern struct arglist *uml_parse_vector_ifspec(char *arg); extern struct arglist *uml_parse_vector_ifspec(char *arg);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/virtio.h> #include <linux/virtio.h>
#include <linux/virtio_config.h> #include <linux/virtio_config.h>
#include <linux/logic_iomem.h> #include <linux/logic_iomem.h>
#include <linux/of_platform.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/virtio_pcidev.h> #include <linux/virtio_pcidev.h>
#include <linux/virtio-uml.h> #include <linux/virtio-uml.h>
...@@ -39,6 +40,8 @@ struct um_pci_device { ...@@ -39,6 +40,8 @@ struct um_pci_device {
unsigned long status; unsigned long status;
int irq; int irq;
bool platform;
}; };
struct um_pci_device_reg { struct um_pci_device_reg {
...@@ -48,13 +51,15 @@ struct um_pci_device_reg { ...@@ -48,13 +51,15 @@ struct um_pci_device_reg {
static struct pci_host_bridge *bridge; static struct pci_host_bridge *bridge;
static DEFINE_MUTEX(um_pci_mtx); static DEFINE_MUTEX(um_pci_mtx);
static struct um_pci_device *um_pci_platform_device;
static struct um_pci_device_reg um_pci_devices[MAX_DEVICES]; static struct um_pci_device_reg um_pci_devices[MAX_DEVICES];
static struct fwnode_handle *um_pci_fwnode; static struct fwnode_handle *um_pci_fwnode;
static struct irq_domain *um_pci_inner_domain; static struct irq_domain *um_pci_inner_domain;
static struct irq_domain *um_pci_msi_domain; static struct irq_domain *um_pci_msi_domain;
static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)]; static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)];
#define UM_VIRT_PCI_MAXDELAY 40000 static unsigned int um_pci_max_delay_us = 40000;
module_param_named(max_delay_us, um_pci_max_delay_us, uint, 0644);
struct um_pci_message_buffer { struct um_pci_message_buffer {
struct virtio_pcidev_msg hdr; struct virtio_pcidev_msg hdr;
...@@ -132,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev, ...@@ -132,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
out ? 1 : 0, out ? 1 : 0,
posted ? cmd : HANDLE_NO_FREE(cmd), posted ? cmd : HANDLE_NO_FREE(cmd),
GFP_ATOMIC); GFP_ATOMIC);
if (ret) if (ret) {
if (posted)
kfree(cmd);
goto out; goto out;
}
if (posted) { if (posted) {
virtqueue_kick(dev->cmd_vq); virtqueue_kick(dev->cmd_vq);
...@@ -155,7 +163,7 @@ static int um_pci_send_cmd(struct um_pci_device *dev, ...@@ -155,7 +163,7 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
kfree(completed); kfree(completed);
if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) || if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) ||
++delay_count > UM_VIRT_PCI_MAXDELAY, ++delay_count > um_pci_max_delay_us,
"um virt-pci delay: %d", delay_count)) { "um virt-pci delay: %d", delay_count)) {
ret = -EIO; ret = -EIO;
break; break;
...@@ -480,6 +488,9 @@ static void um_pci_handle_irq_message(struct virtqueue *vq, ...@@ -480,6 +488,9 @@ static void um_pci_handle_irq_message(struct virtqueue *vq,
struct virtio_device *vdev = vq->vdev; struct virtio_device *vdev = vq->vdev;
struct um_pci_device *dev = vdev->priv; struct um_pci_device *dev = vdev->priv;
if (!dev->irq)
return;
/* we should properly chain interrupts, but on ARCH=um we don't care */ /* we should properly chain interrupts, but on ARCH=um we don't care */
switch (msg->op) { switch (msg->op) {
...@@ -533,6 +544,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq) ...@@ -533,6 +544,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq)
} }
} }
/* Copied from arch/x86/kernel/devicetree.c */
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
{
struct device_node *np;
for_each_node_by_type(np, "pci") {
const void *prop;
unsigned int bus_min;
prop = of_get_property(np, "bus-range", NULL);
if (!prop)
continue;
bus_min = be32_to_cpup(prop);
if (bus->number == bus_min)
return np;
}
return NULL;
}
static int um_pci_init_vqs(struct um_pci_device *dev) static int um_pci_init_vqs(struct um_pci_device *dev)
{ {
struct virtqueue *vqs[2]; struct virtqueue *vqs[2];
...@@ -561,6 +591,55 @@ static int um_pci_init_vqs(struct um_pci_device *dev) ...@@ -561,6 +591,55 @@ static int um_pci_init_vqs(struct um_pci_device *dev)
return 0; return 0;
} }
static void __um_pci_virtio_platform_remove(struct virtio_device *vdev,
struct um_pci_device *dev)
{
virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
mutex_lock(&um_pci_mtx);
um_pci_platform_device = NULL;
mutex_unlock(&um_pci_mtx);
kfree(dev);
}
static int um_pci_virtio_platform_probe(struct virtio_device *vdev,
struct um_pci_device *dev)
{
int ret;
dev->platform = true;
mutex_lock(&um_pci_mtx);
if (um_pci_platform_device) {
mutex_unlock(&um_pci_mtx);
ret = -EBUSY;
goto out_free;
}
ret = um_pci_init_vqs(dev);
if (ret) {
mutex_unlock(&um_pci_mtx);
goto out_free;
}
um_pci_platform_device = dev;
mutex_unlock(&um_pci_mtx);
ret = of_platform_default_populate(vdev->dev.of_node, NULL, &vdev->dev);
if (ret)
__um_pci_virtio_platform_remove(vdev, dev);
return ret;
out_free:
kfree(dev);
return ret;
}
static int um_pci_virtio_probe(struct virtio_device *vdev) static int um_pci_virtio_probe(struct virtio_device *vdev)
{ {
struct um_pci_device *dev; struct um_pci_device *dev;
...@@ -574,6 +653,9 @@ static int um_pci_virtio_probe(struct virtio_device *vdev) ...@@ -574,6 +653,9 @@ static int um_pci_virtio_probe(struct virtio_device *vdev)
dev->vdev = vdev; dev->vdev = vdev;
vdev->priv = dev; vdev->priv = dev;
if (of_device_is_compatible(vdev->dev.of_node, "simple-bus"))
return um_pci_virtio_platform_probe(vdev, dev);
mutex_lock(&um_pci_mtx); mutex_lock(&um_pci_mtx);
for (i = 0; i < MAX_DEVICES; i++) { for (i = 0; i < MAX_DEVICES; i++) {
if (um_pci_devices[i].dev) if (um_pci_devices[i].dev)
...@@ -623,9 +705,11 @@ static void um_pci_virtio_remove(struct virtio_device *vdev) ...@@ -623,9 +705,11 @@ static void um_pci_virtio_remove(struct virtio_device *vdev)
struct um_pci_device *dev = vdev->priv; struct um_pci_device *dev = vdev->priv;
int i; int i;
/* Stop all virtqueues */ if (dev->platform) {
virtio_reset_device(vdev); of_platform_depopulate(&vdev->dev);
vdev->config->del_vqs(vdev); __um_pci_virtio_platform_remove(vdev, dev);
return;
}
device_set_wakeup_enable(&vdev->dev, false); device_set_wakeup_enable(&vdev->dev, false);
...@@ -633,12 +717,27 @@ static void um_pci_virtio_remove(struct virtio_device *vdev) ...@@ -633,12 +717,27 @@ static void um_pci_virtio_remove(struct virtio_device *vdev)
for (i = 0; i < MAX_DEVICES; i++) { for (i = 0; i < MAX_DEVICES; i++) {
if (um_pci_devices[i].dev != dev) if (um_pci_devices[i].dev != dev)
continue; continue;
um_pci_devices[i].dev = NULL; um_pci_devices[i].dev = NULL;
irq_free_desc(dev->irq); irq_free_desc(dev->irq);
break;
} }
mutex_unlock(&um_pci_mtx); mutex_unlock(&um_pci_mtx);
um_pci_rescan(); if (i < MAX_DEVICES) {
struct pci_dev *pci_dev;
pci_dev = pci_get_slot(bridge->bus, i);
if (pci_dev)
pci_stop_and_remove_bus_device_locked(pci_dev);
}
/* Stop all virtqueues */
virtio_reset_device(vdev);
dev->cmd_vq = NULL;
dev->irq_vq = NULL;
vdev->config->del_vqs(vdev);
kfree(dev); kfree(dev);
} }
...@@ -860,6 +959,30 @@ void *pci_root_bus_fwnode(struct pci_bus *bus) ...@@ -860,6 +959,30 @@ void *pci_root_bus_fwnode(struct pci_bus *bus)
return um_pci_fwnode; return um_pci_fwnode;
} }
static long um_pci_map_platform(unsigned long offset, size_t size,
const struct logic_iomem_ops **ops,
void **priv)
{
if (!um_pci_platform_device)
return -ENOENT;
*ops = &um_pci_device_bar_ops;
*priv = &um_pci_platform_device->resptr[0];
return 0;
}
static const struct logic_iomem_region_ops um_pci_platform_ops = {
.map = um_pci_map_platform,
};
static struct resource virt_platform_resource = {
.name = "platform",
.start = 0x10000000,
.end = 0x1fffffff,
.flags = IORESOURCE_MEM,
};
static int __init um_pci_init(void) static int __init um_pci_init(void)
{ {
int err, i; int err, i;
...@@ -868,6 +991,8 @@ static int __init um_pci_init(void) ...@@ -868,6 +991,8 @@ static int __init um_pci_init(void)
&um_pci_cfgspace_ops)); &um_pci_cfgspace_ops));
WARN_ON(logic_iomem_add_region(&virt_iomem_resource, WARN_ON(logic_iomem_add_region(&virt_iomem_resource,
&um_pci_iomem_ops)); &um_pci_iomem_ops));
WARN_ON(logic_iomem_add_region(&virt_platform_resource,
&um_pci_platform_ops));
if (WARN(CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID < 0, if (WARN(CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID < 0,
"No virtio device ID configured for PCI - no PCI support\n")) "No virtio device ID configured for PCI - no PCI support\n"))
......
...@@ -168,7 +168,8 @@ static void vhost_user_check_reset(struct virtio_uml_device *vu_dev, ...@@ -168,7 +168,8 @@ static void vhost_user_check_reset(struct virtio_uml_device *vu_dev,
if (!vu_dev->registered) if (!vu_dev->registered)
return; return;
virtio_break_device(&vu_dev->vdev); vu_dev->registered = 0;
schedule_work(&pdata->conn_broken_wk); schedule_work(&pdata->conn_broken_wk);
} }
...@@ -412,7 +413,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev, ...@@ -412,7 +413,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev,
if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY)
vhost_user_reply(vu_dev, &msg.msg, response); vhost_user_reply(vu_dev, &msg.msg, response);
irq_rc = IRQ_HANDLED; irq_rc = IRQ_HANDLED;
}; }
/* mask EAGAIN as we try non-blocking read until socket is empty */ /* mask EAGAIN as we try non-blocking read until socket is empty */
vu_dev->recv_rc = (rc == -EAGAIN) ? 0 : rc; vu_dev->recv_rc = (rc == -EAGAIN) ? 0 : rc;
return irq_rc; return irq_rc;
...@@ -1136,6 +1137,15 @@ void virtio_uml_set_no_vq_suspend(struct virtio_device *vdev, ...@@ -1136,6 +1137,15 @@ void virtio_uml_set_no_vq_suspend(struct virtio_device *vdev,
static void vu_of_conn_broken(struct work_struct *wk) static void vu_of_conn_broken(struct work_struct *wk)
{ {
struct virtio_uml_platform_data *pdata;
struct virtio_uml_device *vu_dev;
pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk);
vu_dev = platform_get_drvdata(pdata->pdev);
virtio_break_device(&vu_dev->vdev);
/* /*
* We can't remove the device from the devicetree so the only thing we * We can't remove the device from the devicetree so the only thing we
* can do is warn. * can do is warn.
...@@ -1266,8 +1276,14 @@ static int vu_unregister_cmdline_device(struct device *dev, void *data) ...@@ -1266,8 +1276,14 @@ static int vu_unregister_cmdline_device(struct device *dev, void *data)
static void vu_conn_broken(struct work_struct *wk) static void vu_conn_broken(struct work_struct *wk)
{ {
struct virtio_uml_platform_data *pdata; struct virtio_uml_platform_data *pdata;
struct virtio_uml_device *vu_dev;
pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk); pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk);
vu_dev = platform_get_drvdata(pdata->pdev);
virtio_break_device(&vu_dev->vdev);
vu_unregister_cmdline_device(&pdata->pdev->dev, NULL); vu_unregister_cmdline_device(&pdata->pdev->dev, NULL);
} }
......
...@@ -91,7 +91,7 @@ struct cpuinfo_um { ...@@ -91,7 +91,7 @@ struct cpuinfo_um {
extern struct cpuinfo_um boot_cpu_data; extern struct cpuinfo_um boot_cpu_data;
#define cpu_data (&boot_cpu_data) #define cpu_data(cpu) boot_cpu_data
#define current_cpu_data boot_cpu_data #define current_cpu_data boot_cpu_data
#define cache_line_size() (boot_cpu_data.cache_alignment) #define cache_line_size() (boot_cpu_data.cache_alignment)
......
...@@ -29,8 +29,8 @@ void flush_thread(void) ...@@ -29,8 +29,8 @@ void flush_thread(void)
ret = unmap(&current->mm->context.id, 0, TASK_SIZE, 1, &data); ret = unmap(&current->mm->context.id, 0, TASK_SIZE, 1, &data);
if (ret) { if (ret) {
printk(KERN_ERR "flush_thread - clearing address space failed, " printk(KERN_ERR "%s - clearing address space failed, err = %d\n",
"err = %d\n", ret); __func__, ret);
force_sig(SIGKILL); force_sig(SIGKILL);
} }
get_safe_registers(current_pt_regs()->regs.gp, get_safe_registers(current_pt_regs()->regs.gp,
......
...@@ -314,7 +314,7 @@ static inline int update_p4d_range(pgd_t *pgd, unsigned long addr, ...@@ -314,7 +314,7 @@ static inline int update_p4d_range(pgd_t *pgd, unsigned long addr,
return ret; return ret;
} }
void fix_range_common(struct mm_struct *mm, unsigned long start_addr, static void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
unsigned long end_addr, int force) unsigned long end_addr, int force)
{ {
pgd_t *pgd; pgd_t *pgd;
...@@ -597,6 +597,8 @@ void force_flush_all(void) ...@@ -597,6 +597,8 @@ void force_flush_all(void)
struct vm_area_struct *vma; struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0); VMA_ITERATOR(vmi, mm, 0);
mmap_read_lock(mm);
for_each_vma(vmi, vma) for_each_vma(vmi, vma)
fix_range(mm, vma->vm_start, vma->vm_end, 1); fix_range(mm, vma->vm_start, vma->vm_end, 1);
mmap_read_unlock(mm);
} }
...@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
{ {
return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; return *pos < nr_cpu_ids ? &boot_cpu_data + *pos : NULL;
} }
static void *c_next(struct seq_file *m, void *v, loff_t *pos) static void *c_next(struct seq_file *m, void *v, loff_t *pos)
......
#define RUNTIME_DISCARD_EXIT
KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER); KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
#ifdef CONFIG_LD_SCRIPT_STATIC #ifdef CONFIG_LD_SCRIPT_STATIC
......
...@@ -127,12 +127,10 @@ int os_mod_epoll_fd(int events, int fd, void *data) ...@@ -127,12 +127,10 @@ int os_mod_epoll_fd(int events, int fd, void *data)
int os_del_epoll_fd(int fd) int os_del_epoll_fd(int fd)
{ {
struct epoll_event event; struct epoll_event event;
int result;
/* This is quiet as we use this as IO ON/OFF - so it is often /* This is quiet as we use this as IO ON/OFF - so it is often
* invoked on a non-existent fd * invoked on a non-existent fd
*/ */
result = epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, &event); return epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, &event);
return result;
} }
void os_set_ioignore(void) void os_set_ioignore(void)
......
...@@ -60,8 +60,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) ...@@ -60,8 +60,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
printk(UM_KERN_ERR "Registers - \n"); printk(UM_KERN_ERR "Registers - \n");
for (i = 0; i < MAX_REG_NR; i++) for (i = 0; i < MAX_REG_NR; i++)
printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]); printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]);
panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", panic("%s : PTRACE_SETREGS failed, errno = %d\n",
-n); __func__, -n);
} }
err = ptrace(PTRACE_CONT, pid, 0, 0); err = ptrace(PTRACE_CONT, pid, 0, 0);
...@@ -81,20 +81,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) ...@@ -81,20 +81,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
offset = *((unsigned long *) mm_idp->stack + 1); offset = *((unsigned long *) mm_idp->stack + 1);
if (offset) { if (offset) {
data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA); data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA);
printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, " printk(UM_KERN_ERR "%s : ret = %ld, offset = %ld, data = %p\n",
"data = %p\n", ret, offset, data); __func__, ret, offset, data);
syscall = (unsigned long *)((unsigned long)data + data[0]); syscall = (unsigned long *)((unsigned long)data + data[0]);
printk(UM_KERN_ERR "do_syscall_stub: syscall %ld failed, " printk(UM_KERN_ERR "%s: syscall %ld failed, return value = 0x%lx, expected return value = 0x%lx\n",
"return value = 0x%lx, expected return value = 0x%lx\n", __func__, syscall[0], ret, syscall[7]);
syscall[0], ret, syscall[7]); printk(UM_KERN_ERR " syscall parameters: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
printk(UM_KERN_ERR " syscall parameters: "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
syscall[1], syscall[2], syscall[3], syscall[1], syscall[2], syscall[3],
syscall[4], syscall[5], syscall[6]); syscall[4], syscall[5], syscall[6]);
for (n = 1; n < data[0]/sizeof(long); n++) { for (n = 1; n < data[0]/sizeof(long); n++) {
if (n == 1) if (n == 1)
printk(UM_KERN_ERR " additional syscall " printk(UM_KERN_ERR " additional syscall data:");
"data:");
if (n % 4 == 1) if (n % 4 == 1)
printk("\n" UM_KERN_ERR " "); printk("\n" UM_KERN_ERR " ");
printk(" 0x%lx", data[n]); printk(" 0x%lx", data[n]);
......
...@@ -118,8 +118,8 @@ void wait_stub_done(int pid) ...@@ -118,8 +118,8 @@ void wait_stub_done(int pid)
err = ptrace(PTRACE_CONT, pid, 0, 0); err = ptrace(PTRACE_CONT, pid, 0, 0);
if (err) { if (err) {
printk(UM_KERN_ERR "wait_stub_done : continue failed, " printk(UM_KERN_ERR "%s : continue failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
} }
...@@ -130,11 +130,10 @@ void wait_stub_done(int pid) ...@@ -130,11 +130,10 @@ void wait_stub_done(int pid)
bad_wait: bad_wait:
err = ptrace_dump_regs(pid); err = ptrace_dump_regs(pid);
if (err) if (err)
printk(UM_KERN_ERR "Failed to get registers from stub, " printk(UM_KERN_ERR "Failed to get registers from stub, errno = %d\n",
"errno = %d\n", -err); -err);
printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " printk(UM_KERN_ERR "%s : failed to wait for SIGTRAP, pid = %d, n = %d, errno = %d, status = 0x%x\n",
"pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, __func__, pid, n, errno, status);
status);
fatal_sigsegv(); fatal_sigsegv();
} }
...@@ -195,15 +194,15 @@ static void handle_trap(int pid, struct uml_pt_regs *regs, ...@@ -195,15 +194,15 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
__NR_getpid); __NR_getpid);
if (err < 0) { if (err < 0) {
printk(UM_KERN_ERR "handle_trap - nullifying syscall " printk(UM_KERN_ERR "%s - nullifying syscall failed, errno = %d\n",
"failed, errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
err = ptrace(PTRACE_SYSCALL, pid, 0, 0); err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
if (err < 0) { if (err < 0) {
printk(UM_KERN_ERR "handle_trap - continuing to end of " printk(UM_KERN_ERR "%s - continuing to end of syscall failed, errno = %d\n",
"syscall failed, errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
...@@ -212,11 +211,10 @@ static void handle_trap(int pid, struct uml_pt_regs *regs, ...@@ -212,11 +211,10 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
(WSTOPSIG(status) != SIGTRAP + 0x80)) { (WSTOPSIG(status) != SIGTRAP + 0x80)) {
err = ptrace_dump_regs(pid); err = ptrace_dump_regs(pid);
if (err) if (err)
printk(UM_KERN_ERR "Failed to get registers " printk(UM_KERN_ERR "Failed to get registers from process, errno = %d\n",
"from process, errno = %d\n", -err); -err);
printk(UM_KERN_ERR "handle_trap - failed to wait at " printk(UM_KERN_ERR "%s - failed to wait at end of syscall, errno = %d, status = %d\n",
"end of syscall, errno = %d, status = %d\n", __func__, errno, status);
errno, status);
fatal_sigsegv(); fatal_sigsegv();
} }
} }
...@@ -256,8 +254,8 @@ static int userspace_tramp(void *stack) ...@@ -256,8 +254,8 @@ static int userspace_tramp(void *stack)
addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE, addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset); PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
if (addr == MAP_FAILED) { if (addr == MAP_FAILED) {
printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, " printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, errno = %d\n",
"errno = %d\n", STUB_CODE, errno); STUB_CODE, errno);
exit(1); exit(1);
} }
...@@ -267,8 +265,7 @@ static int userspace_tramp(void *stack) ...@@ -267,8 +265,7 @@ static int userspace_tramp(void *stack)
UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_SHARED, fd, offset); MAP_FIXED | MAP_SHARED, fd, offset);
if (addr == MAP_FAILED) { if (addr == MAP_FAILED) {
printk(UM_KERN_ERR "mapping segfault stack " printk(UM_KERN_ERR "mapping segfault stack at 0x%lx failed, errno = %d\n",
"at 0x%lx failed, errno = %d\n",
STUB_DATA, errno); STUB_DATA, errno);
exit(1); exit(1);
} }
...@@ -286,8 +283,8 @@ static int userspace_tramp(void *stack) ...@@ -286,8 +283,8 @@ static int userspace_tramp(void *stack)
sa.sa_sigaction = (void *) v; sa.sa_sigaction = (void *) v;
sa.sa_restorer = NULL; sa.sa_restorer = NULL;
if (sigaction(SIGSEGV, &sa, NULL) < 0) { if (sigaction(SIGSEGV, &sa, NULL) < 0) {
printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV " printk(UM_KERN_ERR "%s - setting SIGSEGV handler failed - errno = %d\n",
"handler failed - errno = %d\n", errno); __func__, errno);
exit(1); exit(1);
} }
} }
...@@ -322,8 +319,8 @@ int start_userspace(unsigned long stub_stack) ...@@ -322,8 +319,8 @@ int start_userspace(unsigned long stub_stack)
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (stack == MAP_FAILED) { if (stack == MAP_FAILED) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "start_userspace : mmap failed, " printk(UM_KERN_ERR "%s : mmap failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
return err; return err;
} }
...@@ -336,8 +333,8 @@ int start_userspace(unsigned long stub_stack) ...@@ -336,8 +333,8 @@ int start_userspace(unsigned long stub_stack)
pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
if (pid < 0) { if (pid < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "start_userspace : clone failed, " printk(UM_KERN_ERR "%s : clone failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
return err; return err;
} }
...@@ -345,31 +342,31 @@ int start_userspace(unsigned long stub_stack) ...@@ -345,31 +342,31 @@ int start_userspace(unsigned long stub_stack)
CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
if (n < 0) { if (n < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "start_userspace : wait failed, " printk(UM_KERN_ERR "%s : wait failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
goto out_kill; goto out_kill;
} }
} while (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGALRM)); } while (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGALRM));
if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) { if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) {
err = -EINVAL; err = -EINVAL;
printk(UM_KERN_ERR "start_userspace : expected SIGSTOP, got " printk(UM_KERN_ERR "%s : expected SIGSTOP, got status = %d\n",
"status = %d\n", status); __func__, status);
goto out_kill; goto out_kill;
} }
if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
(void *) PTRACE_O_TRACESYSGOOD) < 0) { (void *) PTRACE_O_TRACESYSGOOD) < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "start_userspace : PTRACE_OLDSETOPTIONS " printk(UM_KERN_ERR "%s : PTRACE_OLDSETOPTIONS failed, errno = %d\n",
"failed, errno = %d\n", errno); __func__, errno);
goto out_kill; goto out_kill;
} }
if (munmap(stack, UM_KERN_PAGE_SIZE) < 0) { if (munmap(stack, UM_KERN_PAGE_SIZE) < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "start_userspace : munmap failed, " printk(UM_KERN_ERR "%s : munmap failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
goto out_kill; goto out_kill;
} }
...@@ -403,14 +400,14 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs) ...@@ -403,14 +400,14 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
* just kill the process. * just kill the process.
*/ */
if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) { if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
printk(UM_KERN_ERR "userspace - ptrace set regs " printk(UM_KERN_ERR "%s - ptrace set regs failed, errno = %d\n",
"failed, errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
if (put_fp_registers(pid, regs->fp)) { if (put_fp_registers(pid, regs->fp)) {
printk(UM_KERN_ERR "userspace - ptrace set fp regs " printk(UM_KERN_ERR "%s - ptrace set fp regs failed, errno = %d\n",
"failed, errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
...@@ -421,28 +418,28 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs) ...@@ -421,28 +418,28 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
singlestepping(NULL)); singlestepping(NULL));
if (ptrace(op, pid, 0, 0)) { if (ptrace(op, pid, 0, 0)) {
printk(UM_KERN_ERR "userspace - ptrace continue " printk(UM_KERN_ERR "%s - ptrace continue failed, op = %d, errno = %d\n",
"failed, op = %d, errno = %d\n", op, errno); __func__, op, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL)); CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
if (err < 0) { if (err < 0) {
printk(UM_KERN_ERR "userspace - wait failed, " printk(UM_KERN_ERR "%s - wait failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
regs->is_user = 1; regs->is_user = 1;
if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp)) { if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp)) {
printk(UM_KERN_ERR "userspace - PTRACE_GETREGS failed, " printk(UM_KERN_ERR "%s - PTRACE_GETREGS failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
if (get_fp_registers(pid, regs->fp)) { if (get_fp_registers(pid, regs->fp)) {
printk(UM_KERN_ERR "userspace - get_fp_registers failed, " printk(UM_KERN_ERR "%s - get_fp_registers failed, errno = %d\n",
"errno = %d\n", errno); __func__, errno);
fatal_sigsegv(); fatal_sigsegv();
} }
...@@ -494,8 +491,8 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs) ...@@ -494,8 +491,8 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
unblock_signals_trace(); unblock_signals_trace();
break; break;
default: default:
printk(UM_KERN_ERR "userspace - child stopped " printk(UM_KERN_ERR "%s - child stopped with signal %d\n",
"with signal %d\n", sig); __func__, sig);
fatal_sigsegv(); fatal_sigsegv();
} }
pid = userspace_pid[0]; pid = userspace_pid[0];
...@@ -555,15 +552,15 @@ int copy_context_skas0(unsigned long new_stack, int pid) ...@@ -555,15 +552,15 @@ int copy_context_skas0(unsigned long new_stack, int pid)
err = ptrace_setregs(pid, thread_regs); err = ptrace_setregs(pid, thread_regs);
if (err < 0) { if (err < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "copy_context_skas0 : PTRACE_SETREGS " printk(UM_KERN_ERR "%s : PTRACE_SETREGS failed, pid = %d, errno = %d\n",
"failed, pid = %d, errno = %d\n", pid, -err); __func__, pid, -err);
return err; return err;
} }
err = put_fp_registers(pid, thread_fp_regs); err = put_fp_registers(pid, thread_fp_regs);
if (err < 0) { if (err < 0) {
printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers " printk(UM_KERN_ERR "%s : put_fp_registers failed, pid = %d, err = %d\n",
"failed, pid = %d, err = %d\n", pid, err); __func__, pid, err);
return err; return err;
} }
...@@ -574,8 +571,8 @@ int copy_context_skas0(unsigned long new_stack, int pid) ...@@ -574,8 +571,8 @@ int copy_context_skas0(unsigned long new_stack, int pid)
err = ptrace(PTRACE_CONT, pid, 0, 0); err = ptrace(PTRACE_CONT, pid, 0, 0);
if (err) { if (err) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "Failed to continue new process, pid = %d, " printk(UM_KERN_ERR "Failed to continue new process, pid = %d, errno = %d\n",
"errno = %d\n", pid, errno); pid, errno);
return err; return err;
} }
...@@ -583,8 +580,8 @@ int copy_context_skas0(unsigned long new_stack, int pid) ...@@ -583,8 +580,8 @@ int copy_context_skas0(unsigned long new_stack, int pid)
pid = data->parent_err; pid = data->parent_err;
if (pid < 0) { if (pid < 0) {
printk(UM_KERN_ERR "copy_context_skas0 - stub-parent reports " printk(UM_KERN_ERR "%s - stub-parent reports error %d\n",
"error %d\n", -pid); __func__, -pid);
return pid; return pid;
} }
...@@ -594,8 +591,8 @@ int copy_context_skas0(unsigned long new_stack, int pid) ...@@ -594,8 +591,8 @@ int copy_context_skas0(unsigned long new_stack, int pid)
*/ */
wait_stub_done(pid); wait_stub_done(pid);
if (child_data->child_err != STUB_DATA) { if (child_data->child_err != STUB_DATA) {
printk(UM_KERN_ERR "copy_context_skas0 - stub-child %d reports " printk(UM_KERN_ERR "%s - stub-child %d reports error %ld\n",
"error %ld\n", pid, data->child_err); __func__, pid, data->child_err);
err = data->child_err; err = data->child_err;
goto out_kill; goto out_kill;
} }
...@@ -603,8 +600,8 @@ int copy_context_skas0(unsigned long new_stack, int pid) ...@@ -603,8 +600,8 @@ int copy_context_skas0(unsigned long new_stack, int pid)
if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
(void *)PTRACE_O_TRACESYSGOOD) < 0) { (void *)PTRACE_O_TRACESYSGOOD) < 0) {
err = -errno; err = -errno;
printk(UM_KERN_ERR "copy_context_skas0 : PTRACE_OLDSETOPTIONS " printk(UM_KERN_ERR "%s : PTRACE_OLDSETOPTIONS failed, errno = %d\n",
"failed, errno = %d\n", errno); __func__, errno);
goto out_kill; goto out_kill;
} }
...@@ -672,8 +669,8 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) ...@@ -672,8 +669,8 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
kmalloc_ok = 0; kmalloc_ok = 0;
return 1; return 1;
default: default:
printk(UM_KERN_ERR "Bad sigsetjmp return in " printk(UM_KERN_ERR "Bad sigsetjmp return in %s - %d\n",
"start_idle_thread - %d\n", n); __func__, n);
fatal_sigsegv(); fatal_sigsegv();
} }
longjmp(*switch_buf, 1); longjmp(*switch_buf, 1);
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
core-y += arch/x86/crypto/ core-y += arch/x86/crypto/
#
# Disable SSE and other FP/SIMD instructions to match normal x86
#
KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
ifeq ($(CONFIG_X86_32),y) ifeq ($(CONFIG_X86_32),y)
START := 0x8048000 START := 0x8048000
......
...@@ -61,7 +61,7 @@ CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage ...@@ -61,7 +61,7 @@ CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
# #
quiet_cmd_vdso = VDSO $@ quiet_cmd_vdso = VDSO $@
cmd_vdso = $(CC) -nostdlib -o $@ \ cmd_vdso = $(CC) -nostdlib -o $@ \
$(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ $(CC_FLAGS_LTO) $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
......
...@@ -17,8 +17,10 @@ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) ...@@ -17,8 +17,10 @@ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
{ {
long ret; long ret;
asm("syscall" : "=a" (ret) : asm("syscall"
"0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory"); : "=a" (ret)
: "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
: "rcx", "r11", "memory");
return ret; return ret;
} }
...@@ -29,8 +31,10 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) ...@@ -29,8 +31,10 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
{ {
long ret; long ret;
asm("syscall" : "=a" (ret) : asm("syscall"
"0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory"); : "=a" (ret)
: "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
: "rcx", "r11", "memory");
return ret; return ret;
} }
......
...@@ -412,7 +412,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -412,7 +412,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
if (page->index >= end_index) if (page->index >= end_index)
count = inode->i_size & (PAGE_SIZE-1); count = inode->i_size & (PAGE_SIZE-1);
buffer = kmap(page); buffer = kmap_local_page(page);
err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count); err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
if (err != count) { if (err != count) {
...@@ -428,9 +428,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -428,9 +428,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
err = 0; err = 0;
out: out:
kunmap(page); kunmap_local(buffer);
unlock_page(page); unlock_page(page);
return err; return err;
} }
...@@ -441,7 +441,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio) ...@@ -441,7 +441,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
loff_t start = page_offset(page); loff_t start = page_offset(page);
int bytes_read, ret = 0; int bytes_read, ret = 0;
buffer = kmap(page); buffer = kmap_local_page(page);
bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
PAGE_SIZE); PAGE_SIZE);
if (bytes_read < 0) { if (bytes_read < 0) {
...@@ -458,8 +458,9 @@ static int hostfs_read_folio(struct file *file, struct folio *folio) ...@@ -458,8 +458,9 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
out: out:
flush_dcache_page(page); flush_dcache_page(page);
kunmap(page); kunmap_local(buffer);
unlock_page(page); unlock_page(page);
return ret; return ret;
} }
...@@ -484,9 +485,9 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping, ...@@ -484,9 +485,9 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping,
unsigned from = pos & (PAGE_SIZE - 1); unsigned from = pos & (PAGE_SIZE - 1);
int err; int err;
buffer = kmap(page); buffer = kmap_local_page(page);
err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer + from, copied); err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer + from, copied);
kunmap(page); kunmap_local(buffer);
if (!PageUptodate(page) && err == PAGE_SIZE) if (!PageUptodate(page) && err == PAGE_SIZE)
SetPageUptodate(page); SetPageUptodate(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment