Subject: Re: 回复: 回复: 回复: linux-next: build failure after merge of the char-misc tree

From: Greg KH <[email-masked]>
Date: Thu, 3 Jul 2025 13:20:47 +0200

On Thu, Jul 03, 2025 at 11:09:10AM +0000, Xu, Lizhi wrote:
> Please read the context carefully, and you will understand that this is
> where everything starts.

I'm sorry, but I do not understand your quoting style.  Didn't the links
I provided earlier explain this?

> In the code before memset, the ev variable only
> initializes the members of its member hdr.

What code does that?

> Originally, "struct vmci_event_ctx ev = {0};" could be used to solve this
> problem. After careful analysis, I can clearly see that the data after the
> ev member hdr is not fully initialized, so memset() is used to set the
> uninitialized data after the hdr member in ev to 0.

Again, you have a structure that has 2 structures in it, but no
guarantees that there will not be any padding between those structures:

struct vmci_event_ctx {
        struct vmci_event_msg msg;
        struct vmci_event_payld_ctx payload;
};

Nor do you have any guarantee that those structures don't also have
holes in them.  How does any of this work?  Is it just luck?  I walked
things backwards and find it impossible to guess as to any of the fields
here actually being properly aligned or even using the correct data
types to cross the user/kernel boundary.

And then you throw the whole thing on the stack:

> 248                  struct vmci_event_ctx ev;

And attempt to initialize the fields manually.  What could go wrong?
(hint, syzbot showed what went wrong, and the compiler is now telling
you how your proposed fix is not correct in the long-run...)

Please fix this properly.

greg k-h