Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope
Дата
Msg-id 20160215173957.GD25464@awork2.anarazel.de
обсуждение исходный текст
Ответ на [PATCH] Code refactoring related to -fsanitize=use-after-scope  (Martin Liška <mliska@suse.cz>)
Ответы Re: [PATCH] Code refactoring related to -fsanitize=use-after-scope  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2016-02-15 14:37:28 +0100, Martin Liška wrote:
> I've been currently working on support of -sanitize=use-after-scope in the GCC compiler and
> I decided to use postgresql as my test-case. The sanitation poisons every stack variable at the
> very beginning of a function, unpoisons a variable at the beginning of scope definition and finally
> poisons the variable again at the end of scope.

Generally sounds like a good check.

> Following patch fixes issues seen by the sanitizer. Hope it's acceptable?
> With the patch applied, ASAN (with the new sanitization) works fine.


> diff --git a/src/backend/access/spgist/spgdoinsert.c b/src/backend/access/spgist/spgdoinsert.c
> index f090ca5..ff986c2 100644
> --- a/src/backend/access/spgist/spgdoinsert.c
> +++ b/src/backend/access/spgist/spgdoinsert.c
> @@ -1871,6 +1871,10 @@ spgdoinsert(Relation index, SpGistState *state,
>      SPPageDesc    current,
>                  parent;
>      FmgrInfo   *procinfo = NULL;
> +    SpGistInnerTuple innerTuple;
> +    spgChooseIn in;
> +    spgChooseOut out;
> +
>  
>      /*
>       * Look up FmgrInfo of the user-defined choose function once, to save
> @@ -2044,9 +2048,6 @@ spgdoinsert(Relation index, SpGistState *state,
>               * Apply the opclass choose function to figure out how to insert
>               * the given datum into the current inner tuple.
>               */
> -            SpGistInnerTuple innerTuple;
> -            spgChooseIn in;
> -            spgChooseOut out;

But I'm not immediately seing why this is necessary? Is this about
battling a false positive?

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: xlc atomics
Следующее
От: Robbie Harwood
Дата:
Сообщение: Re: [PATCH v5] GSSAPI encryption support