Re: Fix races conditions in DropRole() and GrantRole()

Поиск
Список
Период
Сортировка
Искать
От
Bertrand Drouvot
Тема
Re: Fix races conditions in DropRole() and GrantRole()
Дата
в 06:37:47
Msg-id
alcAi0scidMqjO4y@bdtpg
Ответ на
Список
Дерево обсуждения
Fix races conditions in DropRole() and GrantRole() Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() surya poondla <suryapoondla4@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() surya poondla <suryapoondla4@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() surya poondla <suryapoondla4@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() surya poondla <suryapoondla4@gmail.com>
Re: Fix races conditions in DropRole() and GrantRole() Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Hi Surya,

On Fri, Jul 10, 2026 at 02:42:26PM -0700, surya poondla wrote:
> Instead we can report the OID and it avoids the re-lookup entirely, e.g.
> 
>        if (!SearchSysCacheExists1(AUTHOID, ObjectIdGetDatum(roleid)))
>            ereport(ERROR,
>                    (errcode(ERRCODE_UNDEFINED_OBJECT),
>                     errmsg("role with OID %u does not exist", roleid)));

Agreed and done in the attached.

> 2. The new s2_check_orphans permutations all use named roles, which go
> through the RoleNameGetOid() (CSTRING) path. None exercise the
> CURRENT_USER/SESSION_USER else-branch that the recheck was added for.
> A permutation like "GRANT g TO CURRENT_USER" with a concurrent drop of the
> session's login
> role would cover that else branch and this would also exercise the path in
> point #1

Test added.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
В списке pgsql-hackers по дате отправления
От: solai v
Дата:
От: wenhui qiu
Дата:
FAQ