forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit56d30fb
committed
Disallow converting a table to a view within an outer SQL command.
We have long disallowed all forms of ALTER TABLE if the table isalready opened by some outer SQL command in the same session.This has the same purpose as obtaining AccessExclusiveLock, butsince a session's own locks don't conflict the lock only blocks useof the table by other sessions, not our own. Without this check,the ALTER might confuse the outer SQL command since any previousinspection of the table would potentially become invalid.However, the RelisBecomingView code path in DefineQueryRewrite nevergot that memo, and assumed that AccessExclusiveLock is sufficientfor performing something morally equivalent to a rather invasiveALTER TABLE. Unsurprisingly, this can confuse an outer commandthat is trying to do something with the table.This was submitted as a security issue, but the security teamhas been unable to identify any consequence worse than a nullpointer dereference (from trying to access rd_tableam methodsthat the relation no longer has). Therefore, in accordancewith our usual policy, it's not security material and shouldjust be fixed as a routine bug.Fix by disallowing the operation if the table is open locally,exactly as ALTER TABLE does it.Per an anonymous security researcher, via Bundesamt für Sicherheitin der Informationstechnik.Patch v12-v15 only. In v16 and later, we removed this codealtogether (cf. commitb23cd18), so that there's no issue.1 parentf222349 commit56d30fb
1 file changed
+6
-0
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
| |
35 | 36 |
| |
| |||
422 | 423 |
| |
423 | 424 |
| |
424 | 425 |
| |
| 426 | + | |
| 427 | + | |
| 428 | + | |
425 | 429 |
| |
426 | 430 |
| |
427 | 431 |
| |
| |||
430 | 434 |
| |
431 | 435 |
| |
432 | 436 |
| |
| 437 | + | |
| 438 | + | |
433 | 439 |
| |
434 | 440 |
| |
435 | 441 |
| |
|
0 commit comments
Comments
(0)