io_uring-6.5-2023-08-11
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmTWfMwQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprrID/oD4UD9nszoWno52welJMcQRul9yckO8A8i
HTNOmcXETqNpinnVxA602Tcv5jc/ShnfuA3tMZ3VukCqjCd6RjqRVmzVOev3EMyA
lnx0qOqulHqZ7WKz/M+NEOumYAGmhpqEHUKZnLxYVZ8y3B1l6h0rvcHJfriuJ3uO
d6gw6i5hm+BzxJIDEUmfZqR/qy7oW4uVMAPzpBfhCKPWBJsE1YDjCSeQtb4a3c+f
DXcak/X8ZaONImwVxyHiC6k0VnUs+17oGbKFwY8Kiudy+Fkn5ye6GC2H9MdNaHhk
PYwApNbnC4xoSYEa90oXkKPJwy58iYAoHJ6KNbFfF+TBm1dR2Zne6YSFDLW5DwNu
akfgujSwGT6w0tyjegcrb70pvixeWdnkkBs35Fg7dtYBd2v2RuXZzbqOq7tIBhIG
Jjo42sr2ZL0k1Wj7Sx0VgXwAfKu/rxLsQChMJo/z8qqy0tviIBdtlYlwUgijMxW/
/u8SxuVdOS2UaTLrjGC/pfLEGo+WuG5rcPiM46UySAJJJKGhccwWoH0y5xEI/ARi
Hn3DS500UavzTzvETbv7X4zkODneU3Ibwo2340ePxcxyGqO3i+dpTvATDRbEQq5X
YXkN6qRKcwrlkrAE4K4xRruHTfgg5A8dIFVY7Xjc4pYOV/LMMWG3OfTKoFKrai/9
xhr41rOkxA==
=e2U3
-----END PGP SIGNATURE-----
Merge tag 'io_uring-6.5-2023-08-11' of git://git.kernel.dk/linux
Pull io_uring fixes from Jens Axboe:
"A followup fix for the parisc/SHM_COLOUR fix, also from Helge, which
is heading to stable.
And then just the io_uring equivalent of the RESOLVE_CACHED fix in
commit a0fc452a5d
from last week for build_open_flags()"
* tag 'io_uring-6.5-2023-08-11' of git://git.kernel.dk/linux:
io_uring/parisc: Adjust pgoff in io_uring mmap() for parisc
io_uring: correct check for O_TMPFILE
This commit is contained in:
commit
2e40ed24e1
3 changed files with 12 additions and 12 deletions
|
@ -27,17 +27,12 @@
|
||||||
#include <linux/elf-randomize.h>
|
#include <linux/elf-randomize.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct an artificial page offset for the mapping based on the virtual
|
* Construct an artificial page offset for the mapping based on the physical
|
||||||
* address of the kernel file mapping variable.
|
* address of the kernel file mapping variable.
|
||||||
* If filp is zero the calculated pgoff value aliases the memory of the given
|
|
||||||
* address. This is useful for io_uring where the mapping shall alias a kernel
|
|
||||||
* address and a userspace adress where both the kernel and the userspace
|
|
||||||
* access the same memory region.
|
|
||||||
*/
|
*/
|
||||||
#define GET_FILP_PGOFF(filp, addr) \
|
#define GET_FILP_PGOFF(filp) \
|
||||||
((filp ? (((unsigned long) filp->f_mapping) >> 8) \
|
(filp ? (((unsigned long) filp->f_mapping) >> 8) \
|
||||||
& ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL) \
|
& ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL)
|
||||||
+ (addr >> PAGE_SHIFT))
|
|
||||||
|
|
||||||
static unsigned long shared_align_offset(unsigned long filp_pgoff,
|
static unsigned long shared_align_offset(unsigned long filp_pgoff,
|
||||||
unsigned long pgoff)
|
unsigned long pgoff)
|
||||||
|
@ -117,7 +112,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
|
||||||
do_color_align = 0;
|
do_color_align = 0;
|
||||||
if (filp || (flags & MAP_SHARED))
|
if (filp || (flags & MAP_SHARED))
|
||||||
do_color_align = 1;
|
do_color_align = 1;
|
||||||
filp_pgoff = GET_FILP_PGOFF(filp, addr);
|
filp_pgoff = GET_FILP_PGOFF(filp);
|
||||||
|
|
||||||
if (flags & MAP_FIXED) {
|
if (flags & MAP_FIXED) {
|
||||||
/* Even MAP_FIXED mappings must reside within TASK_SIZE */
|
/* Even MAP_FIXED mappings must reside within TASK_SIZE */
|
||||||
|
|
|
@ -3470,6 +3470,8 @@ static unsigned long io_uring_mmu_get_unmapped_area(struct file *filp,
|
||||||
* - use the kernel virtual address of the shared io_uring context
|
* - use the kernel virtual address of the shared io_uring context
|
||||||
* (instead of the userspace-provided address, which has to be 0UL
|
* (instead of the userspace-provided address, which has to be 0UL
|
||||||
* anyway).
|
* anyway).
|
||||||
|
* - use the same pgoff which the get_unmapped_area() uses to
|
||||||
|
* calculate the page colouring.
|
||||||
* For architectures without such aliasing requirements, the
|
* For architectures without such aliasing requirements, the
|
||||||
* architecture will return any suitable mapping because addr is 0.
|
* architecture will return any suitable mapping because addr is 0.
|
||||||
*/
|
*/
|
||||||
|
@ -3478,6 +3480,7 @@ static unsigned long io_uring_mmu_get_unmapped_area(struct file *filp,
|
||||||
pgoff = 0; /* has been translated to ptr above */
|
pgoff = 0; /* has been translated to ptr above */
|
||||||
#ifdef SHM_COLOUR
|
#ifdef SHM_COLOUR
|
||||||
addr = (uintptr_t) ptr;
|
addr = (uintptr_t) ptr;
|
||||||
|
pgoff = addr >> PAGE_SHIFT;
|
||||||
#else
|
#else
|
||||||
addr = 0UL;
|
addr = 0UL;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,9 +35,11 @@ static bool io_openat_force_async(struct io_open *open)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Don't bother trying for O_TRUNC, O_CREAT, or O_TMPFILE open,
|
* Don't bother trying for O_TRUNC, O_CREAT, or O_TMPFILE open,
|
||||||
* it'll always -EAGAIN
|
* it'll always -EAGAIN. Note that we test for __O_TMPFILE because
|
||||||
|
* O_TMPFILE includes O_DIRECTORY, which isn't a flag we need to force
|
||||||
|
* async for.
|
||||||
*/
|
*/
|
||||||
return open->how.flags & (O_TRUNC | O_CREAT | O_TMPFILE);
|
return open->how.flags & (O_TRUNC | O_CREAT | __O_TMPFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||||
|
|
Loading…
Add table
Reference in a new issue