[LTP] [PATCH v1] read_all :catch alignment faults while reading sys entries seen in commit :bc21785b7336619fb6a67f1fff5afdaf229acc
Subramanya
subramanya.swamy.linux@gmail.com
Wed Jan 3 14:42:45 CET 2024
Hi,
On 03/01/24 18:19, Cyril Hrubis wrote:
> Hi!
>> + /*
>> + * This could catch any alignment faults while reading sys entries
>> + * seen in commit :bc21785b7336619fb6a67f1fff5afdaf229acc so reading 1024 bytes
> ^
> This does not seem to match any kernel upstream commit.
>> + * in chunks of 8 bytes 128 times
>> + */
>> + char check_buf[7];
> ^
> This isn't 8 bytes at all as it's written in
> description.
>> + unsigned int i;
>> +
>> + for (i = 0; i < 128; i++) {
>> + count = read(fd, check_buf, sizeof(check_buf));
>> + if (count == 0 || count < 0)
>> + break;
>> + }
> So the intention is to read the buffer in smaller chunks? I guess that
> it's hard to tell without having seen the kernel bugfix.
My bad i provided the wrong commit id in the commit message for the
kernel bugfix,
https://github.com/torvalds/linux/commit/1bbc21785b7336619fb6a67f1fff5afdaf229acc
>> count = read(fd, buf, sizeof(buf) - 1);
> I wonder should we seek back in the fd, or do pread() with zero offset here?
yes you're right since we are using open instead of fopen pread() with
offset zero should be used else the buffer would not print data read_all
in case the test is run with
-v option
>
>> elapsed = worker_elapsed(worker);
>>
>> @@ -713,5 +727,5 @@ static struct tst_test test = {
>> .cleanup = cleanup,
>> .test_all = run,
>> .forks_child = 1,
>> - .max_runtime = 100,
>> + .max_runtime = 200,
>> };
>> --
>> 2.39.3
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
Best Regards,
Subramanya
More information about the ltp
mailing list