* [axboe-block:io_uring-group 59/60] io_uring/io_uring.c:2036:25: sparse: sparse: restricted io_req_flags_t degrades to integer
@ 2024-11-01 15:55 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-11-01 15:55 UTC (permalink / raw)
To: Jens Axboe; +Cc: oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git io_uring-group
head: 208960febed8e8a2deaadfc0135e934373b16532
commit: 3f048388f63bf3e751c0eca2a55db050c558da61 [59/60] io_uring: extend io_uring_sqe flags bits
config: x86_64-randconfig-123-20241101 (https://download.01.org/0day-ci/archive/20241101/202411012311.7tUtERay-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241101/202411012311.7tUtERay-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411012311.7tUtERay-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
io_uring/io_uring.c: note: in included file (through include/linux/io_uring/cmd.h):
include/linux/io_uring_types.h:182:37: sparse: sparse: array of flexible structures
>> io_uring/io_uring.c:2036:25: sparse: sparse: restricted io_req_flags_t degrades to integer
io_uring/io_uring.c:598:36: sparse: sparse: context imbalance in 'io_req_post_cqe' - unexpected unlock
io_uring/io_uring.c:600:17: sparse: sparse: context imbalance in '__io_submit_flush_completions' - different lock contexts for basic block
vim +2036 io_uring/io_uring.c
2022
2023 static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
2024 const struct io_uring_sqe *sqe)
2025 __must_hold(&ctx->uring_lock)
2026 {
2027 const struct io_issue_def *def;
2028 unsigned int sqe_flags;
2029 int personality;
2030 u8 opcode;
2031
2032 /* req is partially pre-initialised, see io_preinit_req() */
2033 req->opcode = opcode = READ_ONCE(sqe->opcode);
2034 /* same numerical values with corresponding REQ_F_*, safe to copy */
2035 sqe_flags = READ_ONCE(sqe->flags);
> 2036 if (sqe_flags & REQ_F_FLAGS2)
2037 sqe_flags |= (__u32) READ_ONCE(sqe->flags2) << 8;
2038 req->flags = (__force io_req_flags_t) sqe_flags;
2039 req->cqe.user_data = READ_ONCE(sqe->user_data);
2040 req->file = NULL;
2041 req->task = current;
2042 req->cancel_seq_set = false;
2043
2044 if (unlikely(opcode >= IORING_OP_LAST)) {
2045 req->opcode = 0;
2046 return io_init_fail_req(req, -EINVAL);
2047 }
2048 def = &io_issue_defs[opcode];
2049 if (unlikely(sqe_flags & ~SQE_COMMON_FLAGS)) {
2050 /* enforce forwards compatibility on users */
2051 if (sqe_flags & ~SQE_VALID_FLAGS)
2052 return io_init_fail_req(req, -EINVAL);
2053 if (sqe_flags & IOSQE_BUFFER_SELECT) {
2054 if (!def->buffer_select)
2055 return io_init_fail_req(req, -EOPNOTSUPP);
2056 req->buf_index = READ_ONCE(sqe->buf_group);
2057 }
2058 if (sqe_flags & IOSQE_CQE_SKIP_SUCCESS)
2059 ctx->drain_disabled = true;
2060 if (sqe_flags & IOSQE_IO_DRAIN) {
2061 if (ctx->drain_disabled)
2062 return io_init_fail_req(req, -EOPNOTSUPP);
2063 io_init_req_drain(req);
2064 }
2065 }
2066 if (unlikely(ctx->restricted || ctx->drain_active || ctx->drain_next)) {
2067 if (ctx->restricted && !io_check_restriction(ctx, req, sqe_flags))
2068 return io_init_fail_req(req, -EACCES);
2069 /* knock it to the slow queue path, will be drained there */
2070 if (ctx->drain_active)
2071 req->flags |= REQ_F_FORCE_ASYNC;
2072 /* if there is no link, we're at "next" request and need to drain */
2073 if (unlikely(ctx->drain_next) && !ctx->submit_state.link.head) {
2074 ctx->drain_next = false;
2075 ctx->drain_active = true;
2076 req->flags |= REQ_F_IO_DRAIN | REQ_F_FORCE_ASYNC;
2077 }
2078 }
2079
2080 if (!def->ioprio && sqe->ioprio)
2081 return io_init_fail_req(req, -EINVAL);
2082 if (!def->iopoll && (ctx->flags & IORING_SETUP_IOPOLL))
2083 return io_init_fail_req(req, -EINVAL);
2084
2085 if (def->needs_file) {
2086 struct io_submit_state *state = &ctx->submit_state;
2087
2088 req->cqe.fd = READ_ONCE(sqe->fd);
2089
2090 /*
2091 * Plug now if we have more than 2 IO left after this, and the
2092 * target is potentially a read/write to block based storage.
2093 */
2094 if (state->need_plug && def->plug) {
2095 state->plug_started = true;
2096 state->need_plug = false;
2097 blk_start_plug_nr_ios(&state->plug, state->submit_nr);
2098 }
2099 }
2100
2101 personality = 0;
2102 if (req->flags & REQ_F_PERSONALITY)
2103 personality = READ_ONCE(sqe->personality2);
2104 else if (!(req->flags & REQ_F_FLAGS2))
2105 personality = READ_ONCE(sqe->personality);
2106 if (unlikely(personality)) {
2107 int ret;
2108
2109 req->creds = xa_load(&ctx->personalities, personality);
2110 if (!req->creds)
2111 return io_init_fail_req(req, -EINVAL);
2112 get_cred(req->creds);
2113 ret = security_uring_override_creds(req->creds);
2114 if (ret) {
2115 put_cred(req->creds);
2116 return io_init_fail_req(req, ret);
2117 }
2118 req->flags |= REQ_F_CREDS;
2119 }
2120
2121 return def->prep(req, sqe);
2122 }
2123
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-01 15:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 15:55 [axboe-block:io_uring-group 59/60] io_uring/io_uring.c:2036:25: sparse: sparse: restricted io_req_flags_t degrades to integer kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.