* [PATCH v4 0/2] dma-mapping: Add vmap checks to dma_map_single() @ 2019-10-29 21:34 Kees Cook 2019-10-29 21:34 ` [PATCH v4 1/2] " Kees Cook 2019-10-29 21:34 ` [PATCH v4 2/2] usb: core: Remove redundant vmap checks Kees Cook 0 siblings, 2 replies; 11+ messages in thread From: Kees Cook @ 2019-10-29 21:34 UTC (permalink / raw) To: Christoph Hellwig Cc: Kees Cook, Greg Kroah-Hartman, linux-kernel, Stephen Boyd, iommu, Semmle Security Reports, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal v4: use dev_WARN_ONCE() and improve report string (gregkh, robin) v3: https://lore.kernel.org/lkml/20191010222829.21940-1-keescook@chromium.org v2: https://lore.kernel.org/lkml/201910041420.F6E55D29A@keescook v1: https://lore.kernel.org/lkml/201910021341.7819A660@keescook Duplicating patch 1 commit log: As we've seen from USB and other areas[1], we need to always do runtime checks for DMA operating on memory regions that might be remapped. This adds vmap checks (similar to those already in USB but missing in other places) into dma_map_single() so all callers benefit from the checking. [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb -Kees Kees Cook (2): dma-mapping: Add vmap checks to dma_map_single() usb: core: Remove redundant vmap checks drivers/usb/core/hcd.c | 8 +------- include/linux/dma-mapping.h | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-29 21:34 [PATCH v4 0/2] dma-mapping: Add vmap checks to dma_map_single() Kees Cook @ 2019-10-29 21:34 ` Kees Cook 2019-10-30 9:18 ` Greg Kroah-Hartman 2019-10-29 21:34 ` [PATCH v4 2/2] usb: core: Remove redundant vmap checks Kees Cook 1 sibling, 1 reply; 11+ messages in thread From: Kees Cook @ 2019-10-29 21:34 UTC (permalink / raw) To: Christoph Hellwig Cc: Kees Cook, Greg Kroah-Hartman, linux-kernel, Stephen Boyd, iommu, Semmle Security Reports, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal As we've seen from USB and other areas[1], we need to always do runtime checks for DMA operating on memory regions that might be remapped. This adds vmap checks (similar to those already in USB but missing in other places) into dma_map_single() so all callers benefit from the checking. [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb Suggested-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Kees Cook <keescook@chromium.org> --- include/linux/dma-mapping.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 4a1c4fca475a..54de3c496407 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -583,6 +583,12 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, unsigned long attrs) { + /* DMA must never operate on areas that might be remapped. */ + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), + "wanted %zu bytes mapped in vmalloc\n", size)) { + return DMA_MAPPING_ERROR; + } + debug_dma_map_single(dev, ptr, size); return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), size, dir, attrs); -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-29 21:34 ` [PATCH v4 1/2] " Kees Cook @ 2019-10-30 9:18 ` Greg Kroah-Hartman 2019-10-30 18:09 ` Christoph Hellwig 0 siblings, 1 reply; 11+ messages in thread From: Greg Kroah-Hartman @ 2019-10-30 9:18 UTC (permalink / raw) To: Kees Cook Cc: Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Christoph Hellwig, Allison Randal On Tue, Oct 29, 2019 at 02:34:22PM -0700, Kees Cook wrote: > As we've seen from USB and other areas[1], we need to always do runtime > checks for DMA operating on memory regions that might be remapped. This > adds vmap checks (similar to those already in USB but missing in other > places) into dma_map_single() so all callers benefit from the checking. > > [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb > > Suggested-by: Laura Abbott <labbott@redhat.com> > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > include/linux/dma-mapping.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 4a1c4fca475a..54de3c496407 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -583,6 +583,12 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) > static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, > size_t size, enum dma_data_direction dir, unsigned long attrs) > { > + /* DMA must never operate on areas that might be remapped. */ > + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), > + "wanted %zu bytes mapped in vmalloc\n", size)) { > + return DMA_MAPPING_ERROR; > + } That's a very odd error string, I know if I saw it for the first time, I would have no idea what it meant. The USB message at least gives you a bit more context as to what went wrong and how to fix it. How about something like "Memory is not DMA capabable, please fix the allocation of it to be correct", or "non-dma-able memory was attempted to be mapped, but this is impossible to to" or something else. thanks, greg k-h _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-30 9:18 ` Greg Kroah-Hartman @ 2019-10-30 18:09 ` Christoph Hellwig 2019-10-30 18:26 ` Kees Cook 2019-10-30 19:26 ` Greg Kroah-Hartman 0 siblings, 2 replies; 11+ messages in thread From: Christoph Hellwig @ 2019-10-30 18:09 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Kees Cook, Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Christoph Hellwig, Allison Randal On Wed, Oct 30, 2019 at 10:18:49AM +0100, Greg Kroah-Hartman wrote: > On Tue, Oct 29, 2019 at 02:34:22PM -0700, Kees Cook wrote: > > As we've seen from USB and other areas[1], we need to always do runtime > > checks for DMA operating on memory regions that might be remapped. This > > adds vmap checks (similar to those already in USB but missing in other > > places) into dma_map_single() so all callers benefit from the checking. > > > > [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb > > > > Suggested-by: Laura Abbott <labbott@redhat.com> > > Signed-off-by: Kees Cook <keescook@chromium.org> > > --- > > include/linux/dma-mapping.h | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > > index 4a1c4fca475a..54de3c496407 100644 > > --- a/include/linux/dma-mapping.h > > +++ b/include/linux/dma-mapping.h > > @@ -583,6 +583,12 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) > > static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, > > size_t size, enum dma_data_direction dir, unsigned long attrs) > > { > > + /* DMA must never operate on areas that might be remapped. */ > > + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), > > + "wanted %zu bytes mapped in vmalloc\n", size)) { > > + return DMA_MAPPING_ERROR; > > + } > > That's a very odd error string, I know if I saw it for the first time, I > would have no idea what it meant. The USB message at least gives you a > bit more context as to what went wrong and how to fix it. > > How about something like "Memory is not DMA capabable, please fix the > allocation of it to be correct", or "non-dma-able memory was attempted > to be mapped, but this is impossible to to" or something else. I've fixed the message to "rejecting DMA map of vmalloc memory" and applied the patch. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-30 18:09 ` Christoph Hellwig @ 2019-10-30 18:26 ` Kees Cook 2019-10-30 19:26 ` Greg Kroah-Hartman 1 sibling, 0 replies; 11+ messages in thread From: Kees Cook @ 2019-10-30 18:26 UTC (permalink / raw) To: Christoph Hellwig Cc: Greg Kroah-Hartman, linux-kernel, Stephen Boyd, iommu, Semmle Security Reports, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal On Wed, Oct 30, 2019 at 07:09:21PM +0100, Christoph Hellwig wrote: > On Wed, Oct 30, 2019 at 10:18:49AM +0100, Greg Kroah-Hartman wrote: > > On Tue, Oct 29, 2019 at 02:34:22PM -0700, Kees Cook wrote: > > > As we've seen from USB and other areas[1], we need to always do runtime > > > checks for DMA operating on memory regions that might be remapped. This > > > adds vmap checks (similar to those already in USB but missing in other > > > places) into dma_map_single() so all callers benefit from the checking. > > > > > > [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb > > > > > > Suggested-by: Laura Abbott <labbott@redhat.com> > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > > --- > > > include/linux/dma-mapping.h | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > > > index 4a1c4fca475a..54de3c496407 100644 > > > --- a/include/linux/dma-mapping.h > > > +++ b/include/linux/dma-mapping.h > > > @@ -583,6 +583,12 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) > > > static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, > > > size_t size, enum dma_data_direction dir, unsigned long attrs) > > > { > > > + /* DMA must never operate on areas that might be remapped. */ > > > + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), > > > + "wanted %zu bytes mapped in vmalloc\n", size)) { > > > + return DMA_MAPPING_ERROR; > > > + } > > > > That's a very odd error string, I know if I saw it for the first time, I > > would have no idea what it meant. The USB message at least gives you a > > bit more context as to what went wrong and how to fix it. > > > > How about something like "Memory is not DMA capabable, please fix the > > allocation of it to be correct", or "non-dma-able memory was attempted > > to be mapped, but this is impossible to to" or something else. > > I've fixed the message to "rejecting DMA map of vmalloc memory" and > applied the patch. Great; thank you! -- Kees Cook _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-30 18:09 ` Christoph Hellwig 2019-10-30 18:26 ` Kees Cook @ 2019-10-30 19:26 ` Greg Kroah-Hartman 2019-10-30 19:45 ` Christoph Hellwig 1 sibling, 1 reply; 11+ messages in thread From: Greg Kroah-Hartman @ 2019-10-30 19:26 UTC (permalink / raw) To: Christoph Hellwig Cc: Kees Cook, Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal On Wed, Oct 30, 2019 at 07:09:21PM +0100, Christoph Hellwig wrote: > On Wed, Oct 30, 2019 at 10:18:49AM +0100, Greg Kroah-Hartman wrote: > > On Tue, Oct 29, 2019 at 02:34:22PM -0700, Kees Cook wrote: > > > As we've seen from USB and other areas[1], we need to always do runtime > > > checks for DMA operating on memory regions that might be remapped. This > > > adds vmap checks (similar to those already in USB but missing in other > > > places) into dma_map_single() so all callers benefit from the checking. > > > > > > [1] https://git.kernel.org/linus/3840c5b78803b2b6cc1ff820100a74a092c40cbb > > > > > > Suggested-by: Laura Abbott <labbott@redhat.com> > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > > --- > > > include/linux/dma-mapping.h | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > > > index 4a1c4fca475a..54de3c496407 100644 > > > --- a/include/linux/dma-mapping.h > > > +++ b/include/linux/dma-mapping.h > > > @@ -583,6 +583,12 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) > > > static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, > > > size_t size, enum dma_data_direction dir, unsigned long attrs) > > > { > > > + /* DMA must never operate on areas that might be remapped. */ > > > + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), > > > + "wanted %zu bytes mapped in vmalloc\n", size)) { > > > + return DMA_MAPPING_ERROR; > > > + } > > > > That's a very odd error string, I know if I saw it for the first time, I > > would have no idea what it meant. The USB message at least gives you a > > bit more context as to what went wrong and how to fix it. > > > > How about something like "Memory is not DMA capabable, please fix the > > allocation of it to be correct", or "non-dma-able memory was attempted > > to be mapped, but this is impossible to to" or something else. > > I've fixed the message to "rejecting DMA map of vmalloc memory" and > applied the patch. Looks good! You can apply patch 2/2 as well if you want to take that through your tree too. thanks, greg k-h _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-30 19:26 ` Greg Kroah-Hartman @ 2019-10-30 19:45 ` Christoph Hellwig 2019-10-31 6:51 ` Greg Kroah-Hartman 0 siblings, 1 reply; 11+ messages in thread From: Christoph Hellwig @ 2019-10-30 19:45 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Kees Cook, Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Christoph Hellwig, Allison Randal On Wed, Oct 30, 2019 at 08:26:40PM +0100, Greg Kroah-Hartman wrote: > Looks good! You can apply patch 2/2 as well if you want to take that > through your tree too. I can do that, I'll just need a formal ACK from you. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 1/2] dma-mapping: Add vmap checks to dma_map_single() 2019-10-30 19:45 ` Christoph Hellwig @ 2019-10-31 6:51 ` Greg Kroah-Hartman 0 siblings, 0 replies; 11+ messages in thread From: Greg Kroah-Hartman @ 2019-10-31 6:51 UTC (permalink / raw) To: Christoph Hellwig Cc: Kees Cook, Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal On Wed, Oct 30, 2019 at 08:45:32PM +0100, Christoph Hellwig wrote: > On Wed, Oct 30, 2019 at 08:26:40PM +0100, Greg Kroah-Hartman wrote: > > Looks good! You can apply patch 2/2 as well if you want to take that > > through your tree too. > > I can do that, I'll just need a formal ACK from you. Now sent, thanks. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4 2/2] usb: core: Remove redundant vmap checks 2019-10-29 21:34 [PATCH v4 0/2] dma-mapping: Add vmap checks to dma_map_single() Kees Cook 2019-10-29 21:34 ` [PATCH v4 1/2] " Kees Cook @ 2019-10-29 21:34 ` Kees Cook 2019-10-31 6:50 ` Greg Kroah-Hartman 2019-10-31 17:13 ` Christoph Hellwig 1 sibling, 2 replies; 11+ messages in thread From: Kees Cook @ 2019-10-29 21:34 UTC (permalink / raw) To: Christoph Hellwig Cc: Kees Cook, Greg Kroah-Hartman, linux-kernel, Stephen Boyd, iommu, Semmle Security Reports, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Allison Randal Now that the vmap area checks are being performed in the DMA infrastructure directly, there is no need to repeat them in USB. Signed-off-by: Kees Cook <keescook@chromium.org> --- drivers/usb/core/hcd.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index f225eaa98ff8..281568d464f9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1410,10 +1410,7 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, if (hcd->self.uses_pio_for_control) return ret; if (hcd_uses_dma(hcd)) { - if (is_vmalloc_addr(urb->setup_packet)) { - WARN_ONCE(1, "setup packet is not dma capable\n"); - return -EAGAIN; - } else if (object_is_on_stack(urb->setup_packet)) { + if (object_is_on_stack(urb->setup_packet)) { WARN_ONCE(1, "setup packet is on stack\n"); return -EAGAIN; } @@ -1479,9 +1476,6 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, ret = -EAGAIN; else urb->transfer_flags |= URB_DMA_MAP_PAGE; - } else if (is_vmalloc_addr(urb->transfer_buffer)) { - WARN_ONCE(1, "transfer buffer not dma capable\n"); - ret = -EAGAIN; } else if (object_is_on_stack(urb->transfer_buffer)) { WARN_ONCE(1, "transfer buffer is on stack\n"); ret = -EAGAIN; -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v4 2/2] usb: core: Remove redundant vmap checks 2019-10-29 21:34 ` [PATCH v4 2/2] usb: core: Remove redundant vmap checks Kees Cook @ 2019-10-31 6:50 ` Greg Kroah-Hartman 2019-10-31 17:13 ` Christoph Hellwig 1 sibling, 0 replies; 11+ messages in thread From: Greg Kroah-Hartman @ 2019-10-31 6:50 UTC (permalink / raw) To: Kees Cook Cc: Semmle Security Reports, linux-kernel, Stephen Boyd, iommu, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Christoph Hellwig, Allison Randal On Tue, Oct 29, 2019 at 02:34:23PM -0700, Kees Cook wrote: > Now that the vmap area checks are being performed in the DMA > infrastructure directly, there is no need to repeat them in USB. > > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > drivers/usb/core/hcd.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 2/2] usb: core: Remove redundant vmap checks 2019-10-29 21:34 ` [PATCH v4 2/2] usb: core: Remove redundant vmap checks Kees Cook 2019-10-31 6:50 ` Greg Kroah-Hartman @ 2019-10-31 17:13 ` Christoph Hellwig 1 sibling, 0 replies; 11+ messages in thread From: Christoph Hellwig @ 2019-10-31 17:13 UTC (permalink / raw) To: Kees Cook Cc: Greg Kroah-Hartman, linux-kernel, Stephen Boyd, iommu, Semmle Security Reports, Dan Carpenter, Jesper Dangaard Brouer, Thomas Gleixner, Laura Abbott, Robin Murphy, Christoph Hellwig, Allison Randal Thanks, applied to the dma-mapping for-next tree. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-10-31 17:13 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-29 21:34 [PATCH v4 0/2] dma-mapping: Add vmap checks to dma_map_single() Kees Cook 2019-10-29 21:34 ` [PATCH v4 1/2] " Kees Cook 2019-10-30 9:18 ` Greg Kroah-Hartman 2019-10-30 18:09 ` Christoph Hellwig 2019-10-30 18:26 ` Kees Cook 2019-10-30 19:26 ` Greg Kroah-Hartman 2019-10-30 19:45 ` Christoph Hellwig 2019-10-31 6:51 ` Greg Kroah-Hartman 2019-10-29 21:34 ` [PATCH v4 2/2] usb: core: Remove redundant vmap checks Kees Cook 2019-10-31 6:50 ` Greg Kroah-Hartman 2019-10-31 17:13 ` Christoph Hellwig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox