All of lore.kernel.org
 help / color / mirror / Atom feed
From: Azeem Shaikh <azeemshaikh38@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Weinberger <richard@nod.at>, Kees Cook <kees@kernel.org>,
	kernel test robot <lkp@intel.com>,
	 Maxim Krasnyansky <maxk@qti.qualcomm.com>,
	oe-kbuild-all <oe-kbuild-all@lists.linux.dev>,
	 linux-hardening@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	 anton ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	 linux-um <linux-um@lists.infradead.org>
Subject: Re: [PATCH] uml: Replace all non-returning strlcpy with strscpy
Date: Wed, 31 May 2023 10:48:45 -0400	[thread overview]
Message-ID: <CADmuW3WXDg-5SFXkMDE6BmvSwLNHmXpTzBonaOL8eErc4+d3qQ@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdU70uRxnMNb8KCJe8M3BRPPxowRXtj+POcrh+KLkfQyAA@mail.gmail.com>

Thanks Geert and Richard for the review.

On Wed, May 31, 2023 at 4:05 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Wed, May 31, 2023 at 8:23 AM Richard Weinberger <richard@nod.at> wrote:
> > ----- Ursprüngliche Mail -----
> > >>>> arch/um/os-Linux/drivers/tuntap_user.c:149:17: error: implicit declaration of
> > >>>> function 'strscpy'; did you mean 'strncpy'?
> > >>>> [-Werror=implicit-function-declaration]
> > >>     149 |                 strscpy(ifr.ifr_name, pri->dev_name,
> > >>     sizeof(ifr.ifr_name));
> > >>         |                 ^~~~~~~
> > >>         |                 strncpy
> > >>   cc1: some warnings being treated as errors
> > >
> > > Ah, yeah, this is another "not actually in the kernel" cases. Let's ignore this
> > > strlcpy for now.
> >
> > Well, actually it's another case of "not even compile tested". :-(

Argh, my test script wasn't cross-compiling for um. Sorry about that :(

> > Well, strlcpy() isn't part of libc either, so all this would need is to
> > add it to user.h just like strlcpy() is now?
>
> I think so.
> Azeem, can you please test your changes with this fixup applied?
>
> diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
> index bda66e5a9d4e3..e5d3fbbafe4d2 100644
> --- a/arch/um/include/shared/user.h
> +++ b/arch/um/include/shared/user.h
> @@ -52,6 +52,7 @@ static inline int printk(const char *fmt, ...)
>  extern int in_aton(char *str);
>  extern size_t strlcpy(char *, const char *, size_t);
>  extern size_t strlcat(char *, const char *, size_t);
> +extern ssize_t strscpy(char *, const char *, size_t);
>
>  /* Copied from linux/compiler-gcc.h since we can't include it directly */
>  #define barrier() __asm__ __volatile__("": : :"memory")
>

Tested with this fixup, and it builds successfully on ARCH=um
SUBARCH=i386. Let me know if I need to test with any other
cross-compilation options before I send out v2.

>
> Ah, yeah, this is another "not actually in the kernel" cases. Let's ignore this strlcpy for now.
>
> -Keed

Planning to send out v2 with the fixup from Richard applied. Let me
know if that's ok.

WARNING: multiple messages have this Message-ID (diff)
From: Azeem Shaikh <azeemshaikh38@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Weinberger <richard@nod.at>, Kees Cook <kees@kernel.org>,
	kernel test robot <lkp@intel.com>,
	 Maxim Krasnyansky <maxk@qti.qualcomm.com>,
	oe-kbuild-all <oe-kbuild-all@lists.linux.dev>,
	 linux-hardening@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	 anton ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	 linux-um <linux-um@lists.infradead.org>
Subject: Re: [PATCH] uml: Replace all non-returning strlcpy with strscpy
Date: Wed, 31 May 2023 10:48:45 -0400	[thread overview]
Message-ID: <CADmuW3WXDg-5SFXkMDE6BmvSwLNHmXpTzBonaOL8eErc4+d3qQ@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdU70uRxnMNb8KCJe8M3BRPPxowRXtj+POcrh+KLkfQyAA@mail.gmail.com>

Thanks Geert and Richard for the review.

On Wed, May 31, 2023 at 4:05 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Wed, May 31, 2023 at 8:23 AM Richard Weinberger <richard@nod.at> wrote:
> > ----- Ursprüngliche Mail -----
> > >>>> arch/um/os-Linux/drivers/tuntap_user.c:149:17: error: implicit declaration of
> > >>>> function 'strscpy'; did you mean 'strncpy'?
> > >>>> [-Werror=implicit-function-declaration]
> > >>     149 |                 strscpy(ifr.ifr_name, pri->dev_name,
> > >>     sizeof(ifr.ifr_name));
> > >>         |                 ^~~~~~~
> > >>         |                 strncpy
> > >>   cc1: some warnings being treated as errors
> > >
> > > Ah, yeah, this is another "not actually in the kernel" cases. Let's ignore this
> > > strlcpy for now.
> >
> > Well, actually it's another case of "not even compile tested". :-(

Argh, my test script wasn't cross-compiling for um. Sorry about that :(

> > Well, strlcpy() isn't part of libc either, so all this would need is to
> > add it to user.h just like strlcpy() is now?
>
> I think so.
> Azeem, can you please test your changes with this fixup applied?
>
> diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
> index bda66e5a9d4e3..e5d3fbbafe4d2 100644
> --- a/arch/um/include/shared/user.h
> +++ b/arch/um/include/shared/user.h
> @@ -52,6 +52,7 @@ static inline int printk(const char *fmt, ...)
>  extern int in_aton(char *str);
>  extern size_t strlcpy(char *, const char *, size_t);
>  extern size_t strlcat(char *, const char *, size_t);
> +extern ssize_t strscpy(char *, const char *, size_t);
>
>  /* Copied from linux/compiler-gcc.h since we can't include it directly */
>  #define barrier() __asm__ __volatile__("": : :"memory")
>

Tested with this fixup, and it builds successfully on ARCH=um
SUBARCH=i386. Let me know if I need to test with any other
cross-compilation options before I send out v2.

>
> Ah, yeah, this is another "not actually in the kernel" cases. Let's ignore this strlcpy for now.
>
> -Keed

Planning to send out v2 with the fixup from Richard applied. Let me
know if that's ok.

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

  reply	other threads:[~2023-05-31 14:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 16:40 [PATCH] uml: Replace all non-returning strlcpy with strscpy Azeem Shaikh
2023-05-30 16:40 ` Azeem Shaikh
2023-05-30 23:21 ` Kees Cook
2023-05-31  3:18 ` kernel test robot
2023-05-31  3:18   ` kernel test robot
2023-05-31  4:41   ` Kees Cook
2023-05-31  4:41     ` Kees Cook
2023-05-31  6:18     ` Johannes Berg
2023-05-31  6:18       ` Johannes Berg
2023-05-31  6:26       ` Richard Weinberger
2023-05-31  6:26         ` Richard Weinberger
2023-05-31  6:23     ` Richard Weinberger
2023-05-31  6:23       ` Richard Weinberger
2023-05-31  8:05       ` Geert Uytterhoeven
2023-05-31  8:05         ` Geert Uytterhoeven
2023-05-31 14:48         ` Azeem Shaikh [this message]
2023-05-31 14:48           ` Azeem Shaikh
2023-06-05 20:07           ` Richard Weinberger
2023-06-05 20:07             ` Richard Weinberger

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=CADmuW3WXDg-5SFXkMDE6BmvSwLNHmXpTzBonaOL8eErc4+d3qQ@mail.gmail.com \
    --to=azeemshaikh38@gmail.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=geert@linux-m68k.org \
    --cc=johannes@sipsolutions.net \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=maxk@qti.qualcomm.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=richard@nod.at \
    /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.