arm64: virt_to_page() does not return right page for a kernel image address
Ard Biesheuvel
ard.biesheuvel at linaro.org
Wed Jan 4 05:24:51 PST 2017
On 4 January 2017 at 12:23, Pratyush Anand <panand at redhat.com> wrote:
>
>
> 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() -> scatterwalk_copychunks()
>
> 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);
>
This is the bug right here, and it is fixed already upstream. The
crypto test vectors are part of the kernel image, and should not be
used in scatterlists.
> ctemplate is a kernel address (like lzo_comp_tv_template), which was
> assigned to walk->sg latter and passed to kmap_atomic().
>
>
> ~Pratyush
More information about the linux-arm-kernel
mailing list