[PATCH 0/4] linux-user: Fix getdents alignment issues (#704)

Richard Henderson posted 4 patches 2 years, 6 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211107124845.1174791-1-richard.henderson@linaro.org
Maintainers: Laurent Vivier <laurent@vivier.eu>
There is a newer version of this series
linux-user/syscall_defs.h |  12 +-
linux-user/syscall.c      | 290 ++++++++++++++++++--------------------
2 files changed, 141 insertions(+), 161 deletions(-)
[PATCH 0/4] linux-user: Fix getdents alignment issues (#704)
Posted by Richard Henderson 2 years, 6 months ago
There are a number of alignement issues flagged up by clang,
this attempts to fix only one of them: getdents.

r~

Richard Henderson (4):
  linux-user: Split out do_getdents, do_getdents64
  linux-user: Always use flexible arrays for dirent d_name
  linux-user: Fix member types of target_dirent64
  linux-user: Rewrite do_getdents, do_getdents64

 linux-user/syscall_defs.h |  12 +-
 linux-user/syscall.c      | 290 ++++++++++++++++++--------------------
 2 files changed, 141 insertions(+), 161 deletions(-)

-- 
2.25.1


Re: [PATCH 0/4] linux-user: Fix getdents alignment issues (#704)
Posted by Warner Losh 2 years, 6 months ago

> On Nov 7, 2021, at 5:48 AM, Richard Henderson <richard.henderson@linaro.org> wrote:
> 
> There are a number of alignement issues flagged up by clang,
> this attempts to fix only one of them: getdents.

Does it make sense to have size asserts for these types? That would catch the alignment issues and are cheap to maintain since ABI sizes should never change…

Warner

> r~
> 
> Richard Henderson (4):
>  linux-user: Split out do_getdents, do_getdents64
>  linux-user: Always use flexible arrays for dirent d_name
>  linux-user: Fix member types of target_dirent64
>  linux-user: Rewrite do_getdents, do_getdents64
> 
> linux-user/syscall_defs.h |  12 +-
> linux-user/syscall.c      | 290 ++++++++++++++++++--------------------
> 2 files changed, 141 insertions(+), 161 deletions(-)
> 
> -- 
> 2.25.1
> 
> 


Re: [PATCH 0/4] linux-user: Fix getdents alignment issues (#704)
Posted by Richard Henderson 2 years, 6 months ago
On 11/9/21 5:46 PM, Warner Losh wrote:
> 
> 
>> On Nov 7, 2021, at 5:48 AM, Richard Henderson <richard.henderson@linaro.org> wrote:
>>
>> There are a number of alignement issues flagged up by clang,
>> this attempts to fix only one of them: getdents.
> 
> Does it make sense to have size asserts for these types? That would catch the alignment issues and are cheap to maintain since ABI sizes should never change…

Well, the size of getdents64 doesn't change; it merely lands at a different memory offset. 
  But we've now told the compiler about it.


r~

Re: [PATCH 0/4] linux-user: Fix getdents alignment issues (#704)
Posted by Laurent Vivier 2 years, 6 months ago
Le 07/11/2021 à 13:48, Richard Henderson a écrit :
> There are a number of alignement issues flagged up by clang,
> this attempts to fix only one of them: getdents.
> 
> r~
> 
> Richard Henderson (4):
>    linux-user: Split out do_getdents, do_getdents64
>    linux-user: Always use flexible arrays for dirent d_name
>    linux-user: Fix member types of target_dirent64
>    linux-user: Rewrite do_getdents, do_getdents64
> 
>   linux-user/syscall_defs.h |  12 +-
>   linux-user/syscall.c      | 290 ++++++++++++++++++--------------------
>   2 files changed, 141 insertions(+), 161 deletions(-)
> 

Series applied to my linux-user-for-6.2 branch.

Thanks,
Laurent