Re: PL/Python: Fix return in the middle of PG_TRY() block.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: PL/Python: Fix return in the middle of PG_TRY() block.
Дата
Msg-id 20230113072346.ruaiubf4douhmi4i@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: PL/Python: Fix return in the middle of PG_TRY() block.  (Andres Freund <andres@anarazel.de>)
Ответы Re: PL/Python: Fix return in the middle of PG_TRY() block.  (Xing Guo <higuoxing@gmail.com>)
Список pgsql-hackers
Hi,

On 2023-01-12 21:49:00 -0800, Andres Freund wrote:
> Clearly this would need a bunch more work, but it seems promising? I think
> there'd be other uses than this.
> 
> I briefly tried to use it for spinlocks. Mostly works and detects things like
> returning with a spinlock held. But it does not like dynahash's habit of
> conditionally acquiring and releasing spinlocks.

One example is to prevent things like elog()/ereport()/SpinlockAcquire() while
holding a spinlock

The "locks_excluded(thing)" attribute (which is just heuristic, doesn't require
expansive annotation like requires_capability(!thing)), can quite easily be
used to trigger warnings about this kind of thing:

../../../../home/andres/src/postgresql/src/backend/access/transam/xlog.c:6771:2: warning: cannot call function
'errstart'while no_nested_spinlock 'in_spinlock' is held [-Wthread-safety-analysis]
 
        elog(LOG, "logging with spinlock held");


Greetings,

Andres Freund



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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: allowing for control over SET ROLE
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Blocking execution of SECURITY INVOKER