All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: Jackie Liu <liu.yun@linux.dev>
Cc: pasha.tatashin@soleen.com,  rppt@kernel.org,  kexec@lists.infradead.org
Subject: Re: [PATCH 1/2] liveupdate: fix GET_NAME ioctl argument validation
Date: Wed, 15 Jul 2026 16:10:06 +0200	[thread overview]
Message-ID: <2vxztsq0ibsx.fsf@kernel.org> (raw)
In-Reply-To: <20260715060613.19272-1-liu.yun@linux.dev> (Jackie Liu's message of "Wed, 15 Jul 2026 14:06:12 +0800")

Hi,

> Cc: pasha.tatashin@soleen.com,  rppt@kernel.org,  kexec@lists.infradead.org

Please run ./scripts/get_maintainer.pl *.patch to get the full list of
people to Cc on the patch. You missed me and linux-kernel@.

On Wed, Jul 15 2026, Jackie Liu wrote:

> From: Jackie Liu <liuyun01@kylinos.cn>
>
> LIVEUPDATE_SESSION_GET_NAME was developed in the liveupdate/next branch
> while the session type validation change was carried in liveupdate-fixes.
> When the conflict between the two branches was resolved, the GET_NAME
> operation descriptor picked up the structure and last member from
> RETRIEVE_FD.
>
> This makes both its known size and minimum size 16 bytes rather than 72.
> Consequently, copy_struct_from_user() treats most of a normal GET_NAME
> argument as unknown trailing data and rejects it with -E2BIG when any of
> those bytes are nonzero. It also accepts a 16-byte argument and returns
> success after copying only a truncated session name.

Nit: The second line doesn't seem to be true. The get_session_name
selftest tries to create a session with 21 byte name and it passes. I
think it works because luo_session_get_name assumes ucmd->cmd is struct
liveupdate_session_get_name and so it tries to copy the whole thing via
luo_ucmd_respond(), and if the user buffer it large enough, it will
work.

But yeah, the -E2BIG seems like a real problem.

And anyway, that's a tricky bug and I missed it completely when I
reviewed the final rebased version. So thanks for fixing it.

Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>

>
> Use the GET_NAME structure and its name field in the descriptor.
>
> Link: https://lore.kernel.org/all/ahWlYXNjGUbkKoHy@sirena.org.uk/
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
> ---
>  kernel/liveupdate/luo_session.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
> index b79b2a488974..f38b5b18f3f8 100644
> --- a/kernel/liveupdate/luo_session.c
> +++ b/kernel/liveupdate/luo_session.c
> @@ -378,7 +378,7 @@ static const struct luo_ioctl_op luo_session_ioctl_ops[] = {
>  	IOCTL_OP(LIVEUPDATE_SESSION_RETRIEVE_FD, luo_session_retrieve_fd,
>  		 struct liveupdate_session_retrieve_fd, token, LUO_IOCTL_INCOMING),
>  	IOCTL_OP(LIVEUPDATE_SESSION_GET_NAME, luo_session_get_name,
> -		 struct liveupdate_session_retrieve_fd, token, LUO_IOCTL_ALL),
> +		 struct liveupdate_session_get_name, name, LUO_IOCTL_ALL),
>  };
>  
>  static bool luo_ioctl_type_valid(struct luo_session *session,

-- 
Regards,
Pratyush Yadav


      parent reply	other threads:[~2026-07-15 14:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  6:06 [PATCH 1/2] liveupdate: fix GET_NAME ioctl argument validation Jackie Liu
2026-07-15  6:06 ` [PATCH 2/2] liveupdate: reject nonzero reserved value for SESSION_FINISH Jackie Liu
2026-07-15 14:11   ` Pratyush Yadav
2026-07-15 14:10 ` Pratyush Yadav [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2vxztsq0ibsx.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=liu.yun@linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.