On Wed, Sep 7, 2022 at 7:35 PM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote: > > Hi, > > I see some verifier log examples with error like: > > R4 invalid mem access 'inv' > > It looks like invalid mem access errors occur in two places below, > does it make sense to make the error message slightly different so for > new eBPF programmers like me to tell the first invalid mem access is > maybe the memory is NULL? and the second invalid mem access is because > the register type does not match any valid memory pointer? or this > won't help identifying problems and don't bother ? > > 4772 } else if (base_type(reg->type) == PTR_TO_MEM) { > > 4773 bool rdonly_mem = type_is_rdonly_mem(reg->type); > > 4774 > > 4775 if (type_may_be_null(reg->type)) { > > 4776 verbose(env, "R%d invalid mem access > '%s'\n", regno, > > 4777 reg_type_str(env, reg->type)); > > 4778 return -EACCES; > > 4779 } > > and > > 4924 } else { > > 4925 verbose(env, "R%d invalid mem access '%s'\n", regno, > > 4926 reg_type_str(env, reg->type)); > > 4927 return -EACCES; > > 4928 } sorry I should read the code more carefully, I guess the "inv" already says it is invalid memory access, not NULL, right?