All of lore.kernel.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: wangkefeng.wang@huawei.com
Cc: linux-riscv@lists.infradead.org,
	Atish Patra <Atish.Patra@wdc.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	wangkefeng.wang@huawei.com
Subject: Re: [PATCH next] riscv: Add ARCH_HAS_FORTIFY_SOURCE
Date: Tue, 09 Mar 2021 18:19:48 -0800 (PST)	[thread overview]
Message-ID: <mhng-fd999bbb-8271-480a-88b0-8af158d5214a@penguin> (raw)
In-Reply-To: <20210225070303.90530-1-wangkefeng.wang@huawei.com>

On Wed, 24 Feb 2021 23:03:03 PST (-0800), wangkefeng.wang@huawei.com wrote:
> FORTIFY_SOURCE could detect various overflows at compile and run time.
> ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and
> run with CONFIG_FORTIFY_SOURCE. Select it in RISCV.
>
> See more about this feature from commit 6974f0c4555e
> ("include/linux/string.h: add the option of fortified string.h functions").
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/Kconfig              | 1 +
>  arch/riscv/include/asm/string.h | 5 +++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 53e66347366f..fa30fbf66879 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -20,6 +20,7 @@ config RISCV
>  	select ARCH_HAS_DEBUG_VM_PGTABLE
>  	select ARCH_HAS_DEBUG_VIRTUAL if MMU
>  	select ARCH_HAS_DEBUG_WX
> +	select ARCH_HAS_FORTIFY_SOURCE
>  	select ARCH_HAS_GCOV_PROFILE_ALL
>  	select ARCH_HAS_GIGANTIC_PAGE
>  	select ARCH_HAS_KCOV
> diff --git a/arch/riscv/include/asm/string.h b/arch/riscv/include/asm/string.h
> index 5477e7ecb6e1..909049366555 100644
> --- a/arch/riscv/include/asm/string.h
> +++ b/arch/riscv/include/asm/string.h
> @@ -23,5 +23,10 @@ extern asmlinkage void *__memmove(void *, const void *, size_t);
>  #define memcpy(dst, src, len) __memcpy(dst, src, len)
>  #define memset(s, c, n) __memset(s, c, n)
>  #define memmove(dst, src, len) __memmove(dst, src, len)
> +
> +#ifndef __NO_FORTIFY
> +#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
> +#endif
> +
>  #endif
>  #endif /* _ASM_RISCV_STRING_H */

Thanks, this is on for-next.

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

      reply	other threads:[~2021-03-10  2:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  7:03 [PATCH next] riscv: Add ARCH_HAS_FORTIFY_SOURCE Kefeng Wang
2021-03-10  2:19 ` Palmer Dabbelt [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=mhng-fd999bbb-8271-480a-88b0-8af158d5214a@penguin \
    --to=palmer@dabbelt.com \
    --cc=Atish.Patra@wdc.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=paul.walmsley@sifive.com \
    --cc=wangkefeng.wang@huawei.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.