arm64: virt_to_page() does not return right page for a kernel image address

Pratyush Anand panand at
Wed Jan 4 04:23:26 PST 2017

On Wednesday 04 January 2017 05:36 PM, Mark Rutland wrote:
> So it seems we need to fix the crypto test.
> Looking at crypto/testmgr.c, I can't spot the kmap_atomic() or the
> page_address()/virt_to_page(). I guess that's hidden behind helpers,
> which might also be used elsewhere?
> Could you elaborate on where exactly the problem is in the crypto test?

We have in test_acomp() -> crypto_acomp_decompress() -> 
tfm->decompress() -> scomp_acomp_decompress() -> 
scomp_acomp_comp_decomp() -> scatterwalk_map_and_copy() -> 

  41                 if (out != 2) {
  42                         vaddr = scatterwalk_map(walk);
  43                         memcpy_dir(buf, vaddr, len_this_page, out);
  44                         scatterwalk_unmap(vaddr);
  45                 }

scatterwalk_map() gets vaddr from kmap_atomic().

test_acomp() initializes sg:
sg_init_one(&src, ctemplate[i].input, ilen);

ctemplate is a kernel address (like lzo_comp_tv_template), which was 
assigned to walk->sg latter and passed to kmap_atomic().


More information about the linux-arm-kernel mailing list