All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Stitt <justinstitt@google.com>
To: Baoquan He <bhe@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
	kexec@lists.infradead.org,  linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,  linux-hardening@vger.kernel.org
Subject: Re: [PATCH] vmcore: replace strncpy with strtomem
Date: Thu, 28 Mar 2024 13:42:15 -0700	[thread overview]
Message-ID: <CAFhGd8pU-utbgHhU5s_20pC_aNK7xtsJDbf+Ayg4Dck2K=4kag@mail.gmail.com> (raw)
In-Reply-To: <ZgTMZ1HYheBMDbei@MiWiFi-R3L-srv>

Hi,

On Wed, Mar 27, 2024 at 6:48 PM Baoquan He <bhe@redhat.com> wrote:
> > Mark these buffers as __nonstring and use strtomem_pad.
>
> Thanks.
>
> I didn't build, wondering if '__nonstring' has to be set so that
> strtomem_pad() can be used.

I do not believe marking buffers as __nonstring is strictly a
requirement. However, the documentation from string.h +302 says we
should do it:
/**
 * strtomem_pad - Copy NUL-terminated string to non-NUL-terminated buffer
 *
 * @dest: Pointer of destination character array (marked as __nonstring)
...

and so does [1] ... "mark the destination buffer variable (or
structure member) with the __nonstring attribute..."

FWIW, this builds just fine without the __nonstring attribute but we
should use it :)

>
> Thanks
> Baoquan
>

[1] https://github.com/KSPP/linux/issues/90

Thanks
Justin

WARNING: multiple messages have this Message-ID (diff)
From: Justin Stitt <justinstitt@google.com>
To: Baoquan He <bhe@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
	kexec@lists.infradead.org,  linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,  linux-hardening@vger.kernel.org
Subject: Re: [PATCH] vmcore: replace strncpy with strtomem
Date: Thu, 28 Mar 2024 13:42:15 -0700	[thread overview]
Message-ID: <CAFhGd8pU-utbgHhU5s_20pC_aNK7xtsJDbf+Ayg4Dck2K=4kag@mail.gmail.com> (raw)
In-Reply-To: <ZgTMZ1HYheBMDbei@MiWiFi-R3L-srv>

Hi,

On Wed, Mar 27, 2024 at 6:48 PM Baoquan He <bhe@redhat.com> wrote:
> > Mark these buffers as __nonstring and use strtomem_pad.
>
> Thanks.
>
> I didn't build, wondering if '__nonstring' has to be set so that
> strtomem_pad() can be used.

I do not believe marking buffers as __nonstring is strictly a
requirement. However, the documentation from string.h +302 says we
should do it:
/**
 * strtomem_pad - Copy NUL-terminated string to non-NUL-terminated buffer
 *
 * @dest: Pointer of destination character array (marked as __nonstring)
...

and so does [1] ... "mark the destination buffer variable (or
structure member) with the __nonstring attribute..."

FWIW, this builds just fine without the __nonstring attribute but we
should use it :)

>
> Thanks
> Baoquan
>

[1] https://github.com/KSPP/linux/issues/90

Thanks
Justin

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2024-03-28 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 21:10 [PATCH] vmcore: replace strncpy with strtomem Justin Stitt
2024-03-27 21:10 ` Justin Stitt
2024-03-28  1:48 ` Baoquan He
2024-03-28  1:48   ` Baoquan He
2024-03-28 20:42   ` Justin Stitt [this message]
2024-03-28 20:42     ` Justin Stitt
2024-03-28 22:03 ` Kees Cook
2024-03-28 22:03   ` Kees Cook

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='CAFhGd8pU-utbgHhU5s_20pC_aNK7xtsJDbf+Ayg4Dck2K=4kag@mail.gmail.com' \
    --to=justinstitt@google.com \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    /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.