Skip to content

ADBDEV-2361 5.29.2 sync#290

Merged
deart2k merged 11 commits intoadb-5.xfrom
5.29.2-sync
Dec 21, 2021
Merged

ADBDEV-2361 5.29.2 sync#290
deart2k merged 11 commits intoadb-5.xfrom
5.29.2-sync

Conversation

@deart2k
Copy link
Member

@deart2k deart2k commented Dec 20, 2021

Here are some reminders before you submit the pull request

  • Add tests for the change
  • Document changes
  • Communicate in the mailing list if needed
  • Pass make installcheck
  • Review a PR in return to support the community

jimmyyih and others added 11 commits November 8, 2021 16:51
The assertion was added back in 2017 to make sure that change tracking
was disabled when change tracking logs get partially written or
corrupted (mostly due to disk full or other disk issues). However, it
was not noticed that gpaddmirrors goes through the same code path with
mode PMModeMirrorlessSegment (mostly because our gpaddmirrors
automated tests used to run on non-assert builds). The assertion would
always fail when running gpaddmirrors because getFileRepRoleAndState()
only returns valid values for PMModePrimarySegment and
PMModeMirrorSegment. Modify the assertion to make an exception for
gpaddmirrors.

GPDB commit reference:
https://github.com/greenplum-db/gpdb/commit/a0cc23d497a001c82b6cff07d5143be6f2e322b1
1. It is not necessary to create dataflow extension when gpload connect to gpdb5.
2. If there's no GUC or not text format is used, do not create dataflow extension even gpload connect tos gpdb6 or above.

Co-authored-by: Tony Duan <tonyd@vmware.com>
* add gpload input newline config
The server collects up to a bufferload of data whenever it reads data
from the client socket.  When SSL or GSS encryption is requested
during startup, any additional data received with the initial
request message remained in the buffer, and would be treated as
already-decrypted data once the encryption handshake completed.
Thus, a man-in-the-middle with the ability to inject data into the
TCP connection could stuff some cleartext data into the start of
a supposedly encryption-protected database session.

This could be abused to send faked SQL commands to the server,
although that would only work if the server did not demand any
authentication data.  (However, a server relying on SSL certificate
authentication might well not do so.)

To fix, throw a protocol-violation error if the internal buffer
is not empty after the encryption handshake.

Our thanks to Jacob Champion for reporting this problem.

Security: CVE-2021-23214
(cherry picked from commit 046c2c8)
libpq collects up to a bufferload of data whenever it reads data from
the socket.  When SSL or GSS encryption is requested during startup,
any additional data received with the server's yes-or-no reply
remained in the buffer, and would be treated as already-decrypted data
once the encryption handshake completed.  Thus, a man-in-the-middle
with the ability to inject data into the TCP connection could stuff
some cleartext data into the start of a supposedly encryption-protected
database session.

This could probably be abused to inject faked responses to the
client's first few queries, although other details of libpq's behavior
make that harder than it sounds.  A different line of attack is to
exfiltrate the client's password, or other sensitive data that might
be sent early in the session.  That has been shown to be possible with
a server vulnerable to CVE-2021-23214.

To fix, throw a protocol-violation error if the internal buffer
is not empty after the encryption handshake.

Our thanks to Jacob Champion for reporting this problem.

Security: CVE-2021-23222
(cherry picked from commit d83cdfd)
Cherry-picked from e4c6c36 and follow
up 780005f with minor
conflicts resolved. Original commit message follows along with a manual repro
for 5X that involves named portals in extended protocol:

-------------------------------------------------------------------------
Since commit 2fa7c06, we have introduced an opportunity where the
active statement count is leaked (the active statements is not
decremented with ResLockUpdateLimit(.., .., false, ..). This can happen
during a deadlock report or a statement cancellation of a statement
if the session has at least one other active named portal. During
CheckDeadlock()/ResLockWaitCancel(), we would clean up the locallock,
which would cause a subsequent call to ResLockRelease(), for the other
active portal to early return here:

/*
 * If the lock request did not get very far, cleanup is easy.
 */
if (!locallock ||
	!locallock->lock ||
	!locallock->proclock)
{
	elog(LOG, "Resource queue %d: no lock to release", locktag->locktag_field1);
	if (locallock)
	{
		RemoveLocalLock(locallock);
	}

	return false;
}

and not call ResLockUpdateLimit(.., .., false, ..)

The resultant active statement leak would cause subsequently submitted
statements to block forever on the resource queue lock, once the #active
statements = active statement limit.

Additionally, added test coverage for query cancellation and general
sanity checks for leaks in other tests.
-------------------------------------------------------------------------

Manual repro applicable to 5X with extended protocol and named portals:

Consider a JDBC program using named portals with extended protocol (with
prepareThreshold=1, autoCommit=false, fetchSize=1). Let the program run
2 select statements inside the same transaction. Have 2 sessions run
each statement in an interleaved fashion similar to the tests added in
resource_queue_multi_portal.sql with jdb. Use a similar resource queue
with a limit of 2 active statements. This will give rise to a deadlock
and active statement leak.

Note: using the same program described above, a leak with cancellation
can also be achieved.

Co-authored-by: Ashwin Agrawal <aashwin@vmware.com>
Co-authored-by: Yao Wang <wayao@vmware.com>
Co-authored-by: Hongxu Ma <interma@outlook.com>
Co-authored-by: Zhenghua Lyu <78182909+kainwen@users.noreply.github.com>
gporca 3.121 fixes an issue with casting for EXCEPT & INTERSECT that
was crashing executor
@deart2k deart2k requested review from Stolb27 and maksm90 December 20, 2021 09:31
Copy link

@maksm90 maksm90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One have to take a look at PR f6abc9e in the context of #287

@maksm90 maksm90 self-requested a review December 20, 2021 16:04
@Stolb27
Copy link
Collaborator

Stolb27 commented Dec 21, 2021

Failure of regression tests with ORCA on x86_64 (starve_case) is a known problem: https://arenadata.atlassian.net/browse/ADBDEV-2154.
I've already reported about excessive ppc64le test for ADB 5. We don't provide ADB 5 for power. I'm going to open a separate issue.

@maksm90, do you need more time to analyze the upstream patch?

@Stolb27
Copy link
Collaborator

Stolb27 commented Dec 21, 2021

@deart2k, this one is ready to merge.

@deart2k deart2k merged commit b90a267 into adb-5.x Dec 21, 2021
@deart2k deart2k deleted the 5.29.2-sync branch December 21, 2021 08:23
hilltracer pushed a commit that referenced this pull request Mar 6, 2026
- Altlinux 10.2 support
- AstraLinux 1.8 support

Ticket: CI-5297
Stolb27 pushed a commit that referenced this pull request Mar 10, 2026
- Altlinux 10.2 support
- AstraLinux 1.8 support

Ticket: CI-5297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants