Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-06 Thread Andrey Ryabinin
On 09/05/2018 10:44 AM, Kyeongdon Kim wrote: > > > On 2018-09-05 오전 1:24, Andrey Ryabinin wrote: >> >> >> On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: >> > >> > >> > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: >> > >> +#undef strncmp >> +int strncmp(const char *cs, const char *ct,

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-06 Thread Andrey Ryabinin
On 09/05/2018 10:44 AM, Kyeongdon Kim wrote: > > > On 2018-09-05 오전 1:24, Andrey Ryabinin wrote: >> >> >> On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: >> > >> > >> > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: >> > >> +#undef strncmp >> +int strncmp(const char *cs, const char *ct,

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-05 Thread Kyeongdon Kim
On 2018-09-05 오전 1:24, Andrey Ryabinin wrote: On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: > > > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: > +#undef strncmp +int strncmp(const char *cs, const char *ct, size_t len) +{ + check_memory_region((unsigned long)cs, len,

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-05 Thread Kyeongdon Kim
On 2018-09-05 오전 1:24, Andrey Ryabinin wrote: On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: > > > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: > +#undef strncmp +int strncmp(const char *cs, const char *ct, size_t len) +{ + check_memory_region((unsigned long)cs, len,

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Andrey Ryabinin
On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: > > > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: > +#undef strncmp +int strncmp(const char *cs, const char *ct, size_t len) +{ + check_memory_region((unsigned long)cs, len, false, _RET_IP_); +

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Andrey Ryabinin
On 09/04/2018 01:10 PM, Andrey Ryabinin wrote: > > > On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: > +#undef strncmp +int strncmp(const char *cs, const char *ct, size_t len) +{ + check_memory_region((unsigned long)cs, len, false, _RET_IP_); +

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Andrey Ryabinin
On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: >> > +#undef strncmp >> > +int strncmp(const char *cs, const char *ct, size_t len) >> > +{ >> > + check_memory_region((unsigned long)cs, len, false, _RET_IP_); >> > + check_memory_region((unsigned long)ct, len, false, _RET_IP_); >> >> This will

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Andrey Ryabinin
On 09/04/2018 09:59 AM, Kyeongdon Kim wrote: >> > +#undef strncmp >> > +int strncmp(const char *cs, const char *ct, size_t len) >> > +{ >> > + check_memory_region((unsigned long)cs, len, false, _RET_IP_); >> > + check_memory_region((unsigned long)ct, len, false, _RET_IP_); >> >> This will

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Kyeongdon Kim
Hello Andrey, Thanks for your review. On 2018-09-03 오후 6:40, Andrey Ryabinin wrote: On 08/23/2018 11:56 AM, Kyeongdon Kim wrote: > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c > index c3bd520..61ad7f1 100644 > --- a/mm/kasan/kasan.c > +++ b/mm/kasan/kasan.c > @@ -304,6 +304,29 @@ void

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Kyeongdon Kim
Hello Andrey, Thanks for your review. On 2018-09-03 오후 6:40, Andrey Ryabinin wrote: On 08/23/2018 11:56 AM, Kyeongdon Kim wrote: > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c > index c3bd520..61ad7f1 100644 > --- a/mm/kasan/kasan.c > +++ b/mm/kasan/kasan.c > @@ -304,6 +304,29 @@ void

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Kyeongdon Kim
Hello Dmitry, On 2018-09-03 오후 6:13, Dmitry Vyukov wrote: On Mon, Sep 3, 2018 at 11:02 AM, Kyeongdon Kim wrote: > Dear all, > > Could anyone review this and provide me appropriate approach ? > I think str[n]cmp are frequently used functions so I believe very useful w/ > arm64 KASAN. Hi

Re: Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-04 Thread Kyeongdon Kim
Hello Dmitry, On 2018-09-03 오후 6:13, Dmitry Vyukov wrote: On Mon, Sep 3, 2018 at 11:02 AM, Kyeongdon Kim wrote: > Dear all, > > Could anyone review this and provide me appropriate approach ? > I think str[n]cmp are frequently used functions so I believe very useful w/ > arm64 KASAN. Hi

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Andrey Ryabinin
On 08/23/2018 11:56 AM, Kyeongdon Kim wrote: > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c > index c3bd520..61ad7f1 100644 > --- a/mm/kasan/kasan.c > +++ b/mm/kasan/kasan.c > @@ -304,6 +304,29 @@ void *memcpy(void *dest, const void *src, size_t len) > > return __memcpy(dest, src,

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Andrey Ryabinin
On 08/23/2018 11:56 AM, Kyeongdon Kim wrote: > diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c > index c3bd520..61ad7f1 100644 > --- a/mm/kasan/kasan.c > +++ b/mm/kasan/kasan.c > @@ -304,6 +304,29 @@ void *memcpy(void *dest, const void *src, size_t len) > > return __memcpy(dest, src,

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Dmitry Vyukov
On Mon, Sep 3, 2018 at 11:02 AM, Kyeongdon Kim wrote: > Dear all, > > Could anyone review this and provide me appropriate approach ? > I think str[n]cmp are frequently used functions so I believe very useful w/ > arm64 KASAN. Hi Kyeongdon, Please add tests for this to lib/test_kasan.c. > On

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Dmitry Vyukov
On Mon, Sep 3, 2018 at 11:02 AM, Kyeongdon Kim wrote: > Dear all, > > Could anyone review this and provide me appropriate approach ? > I think str[n]cmp are frequently used functions so I believe very useful w/ > arm64 KASAN. Hi Kyeongdon, Please add tests for this to lib/test_kasan.c. > On

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Kyeongdon Kim
Dear all, Could anyone review this and provide me appropriate approach ? I think str[n]cmp are frequently used functions so I believe very useful w/ arm64 KASAN. Best Regards, Kyeongdon Kim On 2018-08-23 오후 5:56, Kyeongdon Kim wrote: This patch declares strcmp/strncmp as weak symbols. (2

Re: [PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-09-03 Thread Kyeongdon Kim
Dear all, Could anyone review this and provide me appropriate approach ? I think str[n]cmp are frequently used functions so I believe very useful w/ arm64 KASAN. Best Regards, Kyeongdon Kim On 2018-08-23 오후 5:56, Kyeongdon Kim wrote: This patch declares strcmp/strncmp as weak symbols. (2

[PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-08-23 Thread Kyeongdon Kim
This patch declares strcmp/strncmp as weak symbols. (2 of them are the most used string operations) Original functions declared as weak and strong ones in mm/kasan/kasan.c could replace them. Assembly optimized strcmp/strncmp functions cannot detect KASan bug. But, now we can detect them like

[PATCH v2] arm64: kasan: add interceptors for strcmp/strncmp functions

2018-08-23 Thread Kyeongdon Kim
This patch declares strcmp/strncmp as weak symbols. (2 of them are the most used string operations) Original functions declared as weak and strong ones in mm/kasan/kasan.c could replace them. Assembly optimized strcmp/strncmp functions cannot detect KASan bug. But, now we can detect them like