lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7647126a-5986-4a2c-9bb0-9efb0ff9c131@ti.com>
Date: Thu, 20 Mar 2025 10:28:33 +0530
From: T Pratham <t-pratham@...com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: Jens Axboe <axboe@...nel.dk>, Robert Jarzmik <robert.jarzmik@...e.fr>,
        Kamlesh Gurudasani <kamlesh@...com>,
        Vignesh Raghavendra <vigneshr@...com>,
        Praneeth Bajjuri <praneeth@...com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lib: scatterlist: Fix sg_split_phys to preserve original
 scatterlist offsets


On 20/03/25 07:16, Andrew Morton wrote:
> On Wed, 19 Mar 2025 16:44:38 +0530 T Pratham <t-pratham@...com> wrote:
>
>> The split_sg_phys function was incorrectly setting the offsets of all
>> scatterlist entries (except the first) to 0. Only the first scatterlist
>> entry's offset and length needs to be modified to account for the skip.
>> Setting the rest entries' offsets to 0 could lead to incorrect data
>> access.
>>
>> This patch removes the offending code, ensuring that the page offsets
>> in the input scatterlist are preserved in the output scatterlist.
> Is this merely from code inspection, or is this issues known to have
> observable runtime effects?
>
> If the latter, please provide a complete description.

Hi,

I am using this function in a crypto driver that I'm currently
developing (not yet sent to mailing list). During testing, it was
observed that the output scatterlists (except the first one) contained
incorrect garbage data.

I narrowed this issue down to the call of sg_split(). Upon debugging
inside this function, I found that this resetting of offset is the cause
of the problem, causing the subsequent scatterlists to point to
incorrect memory locations in a page. By removing this code, I am
obtaining expected data in all the split output scatterlists. Thus, this
was indeed causing observable runtime effects!

Regards
T Pratham <t-pratham@...com>

>> ...
>>
>> --- a/lib/sg_split.c
>> +++ b/lib/sg_split.c
>> @@ -88,8 +88,6 @@ static void sg_split_phys(struct sg_splitter *splitters, const int nb_splits)
>>  			if (!j) {
>>  				out_sg->offset += split->skip_sg0;
>>  				out_sg->length -= split->skip_sg0;
>> -			} else {
>> -				out_sg->offset = 0;
>>  			}
>>  			sg_dma_address(out_sg) = 0;
>>  			sg_dma_len(out_sg) = 0;
>> -- 
>> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ