mbox series

[-next,0/2] Introduce memset_range() helper for wiping members

Message ID 20211208030451.219751-1-xiujianfeng@huawei.com (mailing list archive)
Headers show
Series Introduce memset_range() helper for wiping members | expand

Message

xiujianfeng Dec. 8, 2021, 3:04 a.m. UTC
Xiu Jianfeng (2):
  string.h: Introduce memset_range() for wiping members
  bpf: use memset_range helper in __mark_reg_known

 include/linux/string.h | 20 ++++++++++++++++++++
 kernel/bpf/verifier.c  |  5 ++---
 lib/memcpy_kunit.c     | 12 ++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)

Comments

Kees Cook Dec. 8, 2021, 5:27 a.m. UTC | #1
On Wed, Dec 08, 2021 at 11:04:49AM +0800, Xiu Jianfeng wrote:
> Xiu Jianfeng (2):
>   string.h: Introduce memset_range() for wiping members

For doing a memset range, the preferred method is to use
a struct_group in the structure itself. This makes the range
self-documenting, and allows the compile to validate the exact size,
makes it addressable, etc. The other memset helpers are for "everything
to the end", which doesn't usually benefit from the struct_group style
of range declaration.

>   bpf: use memset_range helper in __mark_reg_known

I never saw this patch arrive on the list?
xiujianfeng Dec. 8, 2021, 10:30 a.m. UTC | #2
在 2021/12/8 13:27, Kees Cook 写道:
> On Wed, Dec 08, 2021 at 11:04:49AM +0800, Xiu Jianfeng wrote:
>> Xiu Jianfeng (2):
>>    string.h: Introduce memset_range() for wiping members
> For doing a memset range, the preferred method is to use
> a struct_group in the structure itself. This makes the range
> self-documenting, and allows the compile to validate the exact size,
> makes it addressable, etc. The other memset helpers are for "everything
> to the end", which doesn't usually benefit from the struct_group style
> of range declaration.
Do you mean there is no need to introduce this helper,  but to use 
struct_group in the struct directly?
>
>>    bpf: use memset_range helper in __mark_reg_known
> I never saw this patch arrive on the list?
I have send this patch as well, can you please check again?
>