From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610690; cv=none; d=zohomail.com; s=zohoarc; b=Vae6hNRSmIBfenO+RIKw7meU4YegUquQPdLO5NMnQzLy1MRwwhXKHBMvTihMq4u1iB4ZK7DFF4ftKndr2PqQa0VfrUswv4lOwbZ64ZJ5EyXxcM6tRj3w0dn7/ebGxZOEu8jFrrPpj/KbVDLxAeGjkRcjTAiX3jzlsdy8l/Jr19A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610690; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bupRsxA4PxPcQKR0C/4MvsGIj4c44qcPAmQ0QpoES/c=; b=FX2zaa0LtfAGFyo3rCnn8Ow2YQ/2pHzaJuFX66EpYpbnHNIRfkxRPAP6JnM0RNaCo+mHRVv++QmVYcaN5QG2WyY95FiEP3zJG4Gie6qQglRpoe0jPEkdBWMYBHJWij9omNO8vmjrpvsdmgd1IWlyS9KgZFH/noM3WHh4VweGu+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610690418671.5625850537918; Tue, 22 Oct 2024 08:24:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3GkL-0007bq-Qf; Tue, 22 Oct 2024 11:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkI-0007SA-G8 for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkG-0004xe-U2 for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:30 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-DwLAbmNBOX6FwWkaBsaq5g-1; Tue, 22 Oct 2024 11:24:24 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 11D4E195422E; Tue, 22 Oct 2024 15:24:22 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AF78E1956046; Tue, 22 Oct 2024 15:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bupRsxA4PxPcQKR0C/4MvsGIj4c44qcPAmQ0QpoES/c=; b=ccyrwUMo/T3C497oLZC1Qg+rRwwSEn6yJjFaZFT4eMl+8DApT7gsH0euqIOQohnGi43ixG 2NyaHtyCXVCsPEG09YQ63GuM7fcJaIKPDZLfJ0CTwnKBKlg2M1/lq56/LC1HcsRXxfdh87 Y8h83lPa3QQH0kPHz/pcjTVHEiPeT24= X-MC-Unique: DwLAbmNBOX6FwWkaBsaq5g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Dr. David Alan Gilbert" Subject: [PULL 01/14] crypto: Remove unused DER string functions Date: Tue, 22 Oct 2024 16:24:02 +0100 Message-ID: <20241022152415.1632556-2-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610691271116600 From: "Dr. David Alan Gilbert" qcrypto_der_encode_octet_str_begin and _end have been unused since they were added in 3b34ccad66 ("crypto: Support DER encodings") Remove them. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Daniel P. Berrang=C3=A9 --- crypto/der.c | 13 ------------- crypto/der.h | 22 ---------------------- 2 files changed, 35 deletions(-) diff --git a/crypto/der.c b/crypto/der.c index ebbecfc3fe..81367524c3 100644 --- a/crypto/der.c +++ b/crypto/der.c @@ -408,19 +408,6 @@ void qcrypto_der_encode_octet_str(QCryptoEncodeContext= *ctx, qcrypto_der_encode_prim(ctx, tag, src, src_len); } =20 -void qcrypto_der_encode_octet_str_begin(QCryptoEncodeContext *ctx) -{ - uint8_t tag =3D QCRYPTO_DER_TAG(QCRYPTO_DER_TAG_CLASS_UNIV, - QCRYPTO_DER_TAG_ENC_PRIM, - QCRYPTO_DER_TYPE_TAG_OCT_STR); - qcrypto_der_encode_cons_begin(ctx, tag); -} - -void qcrypto_der_encode_octet_str_end(QCryptoEncodeContext *ctx) -{ - qcrypto_der_encode_cons_end(ctx); -} - size_t qcrypto_der_encode_ctx_buffer_len(QCryptoEncodeContext *ctx) { return ctx->root.dlen; diff --git a/crypto/der.h b/crypto/der.h index f4ba6da28a..bcfa4a2495 100644 --- a/crypto/der.h +++ b/crypto/der.h @@ -242,28 +242,6 @@ void qcrypto_der_encode_null(QCryptoEncodeContext *ctx= ); void qcrypto_der_encode_octet_str(QCryptoEncodeContext *ctx, const uint8_t *src, size_t src_len); =20 -/** - * qcrypto_der_encode_octet_str_begin: - * @ctx: the encode context. - * - * Start encoding a octet string, All fields between - * qcrypto_der_encode_octet_str_begin and qcrypto_der_encode_octet_str_end - * are encoded as an octet string. This is useful when we need to encode a - * encoded SEQUENCE as OCTET STRING. - */ -void qcrypto_der_encode_octet_str_begin(QCryptoEncodeContext *ctx); - -/** - * qcrypto_der_encode_octet_str_end: - * @ctx: the encode context. - * - * Finish encoding a octet string, All fields between - * qcrypto_der_encode_octet_str_begin and qcrypto_der_encode_octet_str_end - * are encoded as an octet string. This is useful when we need to encode a - * encoded SEQUENCE as OCTET STRING. - */ -void qcrypto_der_encode_octet_str_end(QCryptoEncodeContext *ctx); - /** * qcrypto_der_encode_ctx_buffer_len: * @ctx: the encode context. --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610796; cv=none; d=zohomail.com; s=zohoarc; b=ZHsgtGBeL1038Crp4KvBPrupaspiec1ZL4mDb5C9zYcmfq69CPWVVgkbyqn0q7ec+WNOBWmRIYOh+dzSbbDt3h5mLmz90KvNI0tt+I7PfPmIrK1DdF+jbZCbpylVysiV+CJWbNhfyIK5aXMOHayqJYkJC95EOcd2TOlLYV2m6zQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610796; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OTQ6oHWtR4o7XzRFPiGtn1wRQxJXoWFgPGHC0CJImaQ=; b=Ro5o1VP69G7paA8r2mdQ8tl6lOzXK7QD0H0ZBPTy6ThjyOa9k3o4KysoJrpD48KD/4NLrn5CXN4WX4YIPwISfUsttYbP33FpYm+yzyNVRZOIkPctnkF7R1rHMzI7wc+qrVD0CpWTEjPrtJrFG6bd2WxCgR3WxImPdq+pkboOe8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610796541451.9769839112322; Tue, 22 Oct 2024 08:26:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3GkK-0007Ze-Sw; Tue, 22 Oct 2024 11:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkJ-0007Vp-Pn for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkI-0004xv-0X for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:31 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-NFQG_pXTPy2svcrGqJ4_8A-1; Tue, 22 Oct 2024 11:24:26 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 208A91955D4C; Tue, 22 Oct 2024 15:24:25 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 75B2319560B2; Tue, 22 Oct 2024 15:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OTQ6oHWtR4o7XzRFPiGtn1wRQxJXoWFgPGHC0CJImaQ=; b=Tc9xo9MvmVks/RtyNPwe0kZM41OKLOtEG+Ai8j5cTK91zbhSFaohoQmJs/5Yuy/vRrMUl1 VUnemcrr+JbP7Hqez6anddVWEv2z0C7B/1RjwDwHxj/UQku1ZMk89n43Kgq1s3c3g9o+im k7l/K89AaStUcWoomBchJ+XFtCN9Z9Q= X-MC-Unique: NFQG_pXTPy2svcrGqJ4_8A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Dr. David Alan Gilbert" Subject: [PULL 02/14] sockets: Remove deadcode Date: Tue, 22 Oct 2024 16:24:03 +0100 Message-ID: <20241022152415.1632556-3-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610797224116600 From: "Dr. David Alan Gilbert" socket_remote_address hasn't been used since it was added in 17c55decec ("sockets: add helpers for creating SocketAddress from a socke= t") inet_connect hasn't been used since 2017's 8ecc2f9eab ("sheepdog: Use SocketAddress and socket_connect()") Remove them. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Daniel P. Berrang=C3=A9 --- include/qemu/sockets.h | 16 ---------------- util/qemu-sockets.c | 35 ----------------------------------- 2 files changed, 51 deletions(-) diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index d935fd80da..c562690d89 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -61,7 +61,6 @@ int socket_set_fast_reuse(int fd); int inet_ai_family_from_address(InetSocketAddress *addr, Error **errp); int inet_parse(InetSocketAddress *addr, const char *str, Error **errp); -int inet_connect(const char *str, Error **errp); int inet_connect_saddr(InetSocketAddress *saddr, Error **errp); =20 NetworkAddressFamily inet_netfamily(int family); @@ -117,21 +116,6 @@ socket_sockaddr_to_address(struct sockaddr_storage *sa, */ SocketAddress *socket_local_address(int fd, Error **errp); =20 -/** - * socket_remote_address: - * @fd: the socket file handle - * @errp: pointer to uninitialized error object - * - * Get the string representation of the remote socket - * address. A pointer to the allocated address information - * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress() when no - * longer required. - * - * Returns: the socket address struct, or NULL on error - */ -SocketAddress *socket_remote_address(int fd, Error **errp); - /** * socket_address_flatten: * @addr: the socket address to flatten diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 60c44b2b56..c1b162b056 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -707,26 +707,6 @@ int inet_parse(InetSocketAddress *addr, const char *st= r, Error **errp) } =20 =20 -/** - * Create a blocking socket and connect it to an address. - * - * @str: address string - * @errp: set in case of an error - * - * Returns -1 in case of error, file descriptor on success - **/ -int inet_connect(const char *str, Error **errp) -{ - int sock =3D -1; - InetSocketAddress *addr =3D g_new(InetSocketAddress, 1); - - if (!inet_parse(addr, str, errp)) { - sock =3D inet_connect_saddr(addr, errp); - } - qapi_free_InetSocketAddress(addr); - return sock; -} - #ifdef CONFIG_AF_VSOCK static bool vsock_parse_vaddr_to_sockaddr(const VsockSocketAddress *vaddr, struct sockaddr_vm *svm, @@ -1421,21 +1401,6 @@ SocketAddress *socket_local_address(int fd, Error **= errp) } =20 =20 -SocketAddress *socket_remote_address(int fd, Error **errp) -{ - struct sockaddr_storage ss; - socklen_t sslen =3D sizeof(ss); - - if (getpeername(fd, (struct sockaddr *)&ss, &sslen) < 0) { - error_setg_errno(errp, errno, "%s", - "Unable to query remote socket address"); - return NULL; - } - - return socket_sockaddr_to_address(&ss, sslen, errp); -} - - SocketAddress *socket_address_flatten(SocketAddressLegacy *addr_legacy) { SocketAddress *addr; --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610740; cv=none; d=zohomail.com; s=zohoarc; b=Nyye1Ck5mm+9ktWEt8LBMbklKcVMHAVXwS1lKPIVp29b3iN3/8QJgebbvMJbvKmaZShPD1dsJvVMxWqxn7jULgwFwwy7aUtf2QwWp+3d7zVTtZJRr+ZErKSyV8stBTrIumaShbfgzIp4/8FVF0rze3KI6FBLtOm+8OP6+UV6udk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610740; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9C5ciISird3Pqd1kxcsy5MD0cbnXg6lyR4YKJgacZEE=; b=U63oeUYuRyWXffsWJXaVaRoWZ5aiipTzLZeh68POGR4rGpHtrLNcRkVXGLPd7vDfvSwuN28RPtroI9QBOQY/IScPP/Kl+ckMrsO0jdIEl6Pvmzxys5Ip5m0THZ0Gj96izyRxPkEbIfRb8bMLvF7XIo36//5uRQBcG6D+MDgvbbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610740315295.20483257291176; Tue, 22 Oct 2024 08:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3GkO-0007h5-P1; Tue, 22 Oct 2024 11:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkN-0007fe-2z for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkL-0004yb-E4 for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:34 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-328-L5-o78xVMsiz7ywCnEof6A-1; Tue, 22 Oct 2024 11:24:29 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8A9E51955BC5; Tue, 22 Oct 2024 15:24:28 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8235419560B2; Tue, 22 Oct 2024 15:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9C5ciISird3Pqd1kxcsy5MD0cbnXg6lyR4YKJgacZEE=; b=JHk+egCqnQtO8HqGm+O6UFD3VoILaqt43a6KTYynUHnwXGqI8SY2+VQQ0qWbUxvZsqLFHE lQlP0uChMNU0MEgcUcjjYUeQFpJDLVoHvT8EJlOz8W7bvfxgMDq5X1OhbZVVwGrW/zvabW daV7R9TdzVIuSBvAqoK1riFl+uEhJvo= X-MC-Unique: L5-o78xVMsiz7ywCnEof6A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Xu , Fabiano Rosas Subject: [PULL 03/14] util: don't set SO_REUSEADDR on client sockets Date: Tue, 22 Oct 2024 16:24:04 +0100 Message-ID: <20241022152415.1632556-4-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610741026116600 Setting the SO_REUSEADDR property on a socket allows binding to a port number that is in the TIMED_WAIT state. This is usually done on listener sockets, to enable a server to restart itself without having to wait for the completion of TIMED_WAIT on the port. It is also possible, but highly unusual, to set it on client sockets. It is rare to explicitly bind() a client socket, since it is almost always fine to allow the kernel to auto-bind a client socket to a random free port. Most systems will have many 10's of 1000's of free ports that client sockets will be bound to. eg on Linux $ sysctl -a | grep local_port net.ipv4.ip_local_port_range =3D 32768 60999 eg on OpenBSD $ sysctl -a | grep net.inet.ip.port net.inet.ip.portfirst=3D1024 net.inet.ip.portlast=3D49151 net.inet.ip.porthifirst=3D49152 net.inet.ip.porthilast=3D65535 A connected socket must have a unique set of value for (protocol, localip, localport, remoteip, remoteport) otherwise it is liable to get EADDRINUSE. A client connection should trivially avoid EADDRINUSE if letting the kernel auto-assign the 'localport' value, which QEMU always does. When QEMU sets SO_REUSEADDR on a client socket on OpenBSD, however, it upsets this situation. The OpenBSD kernel appears to happily pick a 'localport' that is in the TIMED_WAIT state, even if there are many other available local ports available for use that are not in the TIMED_WAIT state. A test program that just loops opening client sockets will start seeing EADDRINUSE on OpenBSD when as few as 2000 ports are in TIMED_WAIT, despite 10's of 1000's ports still being unused. This contrasts with Linux which appears to avoid picking local ports in TIMED_WAIT state. This problem on OpenBSD exhibits itself periodically with the migration test failing with a message like[1]: qemu-system-ppc64: Failed to connect to '127.0.0.1:24109': Address alread= y in use While I have not been able to reproduce the OpenBSD failure in my own testing, given the scope of what QEMU tests do, it is entirely possible that there could be a lot of ports in TIMED_WAIT state when the migration test runs. Removing SO_REUSEADDR from the client sockets should not affect normal QEMU usage, and should improve reliability on OpenBSD. This use of SO_REUSEADDR on client sockets is highly unusual, and appears to have been present since the very start of the QEMU socket helpers in 2008. The orignal commit has no comment about the use of SO_REUSEADDR on the client, so is most likely just an 16 year old copy+paste bug. [1] https://lists.nongnu.org/archive/html/qemu-devel/2024-10/msg03427.html https://lists.nongnu.org/archive/html/qemu-devel/2024-02/msg01572.html Fixes: d247d25f18764402899b37c381bb696a79000b4e Reviewed-by: Peter Xu Reviewed-by: Fabiano Rosas Signed-off-by: Daniel P. Berrang=C3=A9 --- util/qemu-sockets.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index c1b162b056..77477c1cd5 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -367,7 +367,6 @@ static int inet_connect_addr(const InetSocketAddress *s= addr, addr->ai_family); return -1; } - socket_set_fast_reuse(sock); =20 /* connect to peer */ do { --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610859; cv=none; d=zohomail.com; s=zohoarc; b=X0DtUGBDGE9q2gw8+w44QTSk/NQ+qn8T5qXB6c7w53Qjpfhx5b8K42oTWCd+bDzE6AQm20AWaU42EZPoYOJDSEiaSORhMoCNd8Inb12IMaADqsGRcyOfTJPjNG/jCCjZ/VP8C9AoB63YkDZVqNWxou3YHuhATvBXzQKrP+lxrXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610859; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=84N2rxqupBUcdaTpHle3WoL4A06cF9MmgU6vQgWoN4s=; b=ZN+frVy9gq40ik9Mfoz9oUaARUFEs3E4nsjE+/oetAsPpBupocW90H8Ley7GZggBc5Q/mZ7rEoeRCDDcHw41oShd2LSzNxh9rThG6DlEvLCMEab2H7BeK6yccy8T/Fim5aDwsO4PvcJBZGW1ICLg+Yv115p1K8C8jQWLOSm/XAY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610859529724.6227852834727; Tue, 22 Oct 2024 08:27:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3GkY-0007j1-RX; Tue, 22 Oct 2024 11:24:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkR-0007i6-Ci for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkP-0004za-65 for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:38 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-jL6oenC3MIe6J0JtEi16FQ-1; Tue, 22 Oct 2024 11:24:32 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5FBEE1953978; Tue, 22 Oct 2024 15:24:31 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EDBA219560A2; Tue, 22 Oct 2024 15:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=84N2rxqupBUcdaTpHle3WoL4A06cF9MmgU6vQgWoN4s=; b=erHES6USrv1jPkAXxtQ2tBJ/BYGAz0UB1A8fphqjwqfCoASpaqGRaTpy4xWZI2OiVl1Ttq 7OQDorOgiPl8NKMCn6t6Jh1usmL2s93ZgCu6wR+gsTETGDGc2AuuCAQjkqoMFv8N7ko1le BCY9hy8DlftucLKpWf9rWRFWUoWY+xo= X-MC-Unique: jL6oenC3MIe6J0JtEi16FQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dorjoy Chowdhury Subject: [PULL 04/14] crypto/hash: avoid overwriting user supplied result pointer Date: Tue, 22 Oct 2024 16:24:05 +0100 Message-ID: <20241022152415.1632556-5-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.697, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610861729116600 If the user provides a pre-allocated buffer for the hash result, we must use that rather than re-allocating a new buffer. Reported-by: Dorjoy Chowdhury Signed-off-by: Daniel P. Berrang=C3=A9 --- crypto/hash-gcrypt.c | 15 ++++++++++++--- crypto/hash-glib.c | 11 +++++++++-- crypto/hash-gnutls.c | 16 +++++++++++++--- crypto/hash-nettle.c | 14 +++++++++++--- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/crypto/hash-gcrypt.c b/crypto/hash-gcrypt.c index ccc3cce3f8..73533a4949 100644 --- a/crypto/hash-gcrypt.c +++ b/crypto/hash-gcrypt.c @@ -103,16 +103,25 @@ int qcrypto_gcrypt_hash_finalize(QCryptoHash *hash, size_t *result_len, Error **errp) { + int ret; unsigned char *digest; gcry_md_hd_t *ctx =3D hash->opaque; =20 - *result_len =3D gcry_md_get_algo_dlen(qcrypto_hash_alg_map[hash->alg]); - if (*result_len =3D=3D 0) { + ret =3D gcry_md_get_algo_dlen(qcrypto_hash_alg_map[hash->alg]); + if (ret =3D=3D 0) { error_setg(errp, "Unable to get hash length"); return -1; } =20 - *result =3D g_new(uint8_t, *result_len); + if (*result_len =3D=3D 0) { + *result_len =3D ret; + *result =3D g_new(uint8_t, *result_len); + } else if (*result_len !=3D ret) { + error_setg(errp, + "Result buffer size %zu is smaller than hash %d", + *result_len, ret); + return -1; + } =20 /* Digest is freed by gcry_md_close(), copy it */ digest =3D gcry_md_read(*ctx, 0); diff --git a/crypto/hash-glib.c b/crypto/hash-glib.c index 02a6ec1edf..809cef98ae 100644 --- a/crypto/hash-glib.c +++ b/crypto/hash-glib.c @@ -99,8 +99,15 @@ int qcrypto_glib_hash_finalize(QCryptoHash *hash, return -1; } =20 - *result_len =3D ret; - *result =3D g_new(uint8_t, *result_len); + if (*result_len =3D=3D 0) { + *result_len =3D ret; + *result =3D g_new(uint8_t, *result_len); + } else if (*result_len !=3D ret) { + error_setg(errp, + "Result buffer size %zu is smaller than hash %d", + *result_len, ret); + return -1; + } =20 g_checksum_get_digest(ctx, *result, result_len); return 0; diff --git a/crypto/hash-gnutls.c b/crypto/hash-gnutls.c index 34a63994c9..99fbe824ea 100644 --- a/crypto/hash-gnutls.c +++ b/crypto/hash-gnutls.c @@ -115,14 +115,24 @@ int qcrypto_gnutls_hash_finalize(QCryptoHash *hash, Error **errp) { gnutls_hash_hd_t *ctx =3D hash->opaque; + int ret; =20 - *result_len =3D gnutls_hash_get_len(qcrypto_hash_alg_map[hash->alg]); - if (*result_len =3D=3D 0) { + ret =3D gnutls_hash_get_len(qcrypto_hash_alg_map[hash->alg]); + if (ret =3D=3D 0) { error_setg(errp, "Unable to get hash length"); return -1; } =20 - *result =3D g_new(uint8_t, *result_len); + if (*result_len =3D=3D 0) { + *result_len =3D ret; + *result =3D g_new(uint8_t, *result_len); + } else if (*result_len !=3D ret) { + error_setg(errp, + "Result buffer size %zu is smaller than hash %d", + *result_len, ret); + return -1; + } + gnutls_hash_output(*ctx, *result); return 0; } diff --git a/crypto/hash-nettle.c b/crypto/hash-nettle.c index 3b847aa60e..c78624b347 100644 --- a/crypto/hash-nettle.c +++ b/crypto/hash-nettle.c @@ -150,9 +150,17 @@ int qcrypto_nettle_hash_finalize(QCryptoHash *hash, Error **errp) { union qcrypto_hash_ctx *ctx =3D hash->opaque; - - *result_len =3D qcrypto_hash_alg_map[hash->alg].len; - *result =3D g_new(uint8_t, *result_len); + int ret =3D qcrypto_hash_alg_map[hash->alg].len; + + if (*result_len =3D=3D 0) { + *result_len =3D ret; + *result =3D g_new(uint8_t, *result_len); + } else if (*result_len !=3D ret) { + error_setg(errp, + "Result buffer size %zu is smaller than hash %d", + *result_len, ret); + return -1; + } =20 qcrypto_hash_alg_map[hash->alg].result(ctx, *result_len, *result); =20 --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610779; cv=none; d=zohomail.com; s=zohoarc; b=m7e83vl//dQ3YwtaDFO2StA5NnW6nUrx3g4MUIlR84xepWKcV1aiTQMv2IoNkJwepWjAlQQatbXrDYqZTdJKClLKU5ZqQOl0ZA0Tjq9RKg03XUAMcle154Mk6Xn9tmccG7QtNJS3H9r7tfO9qCa7p6sCf984e0qav+75Ep4c5kw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610779; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xg+/wJ8KaQvUaWOc4vR3Cy3gH+8WYWyHSb5gAzBFwzU=; b=PxETxG/DKxI+uuUShQSgKmkYGEIDZmluD1lRI51RApEdmMPw4h9lsLo+QARE1A4b944Ws1fRHxyGnkSmirgJXLSzhDqHVvoYgJWWuphHpBVOyGySeTtjMFn6vb8040HnhQcrcxJpOejEwp4iWdu+jfJo6TeQ6XiqVERt2dEfE3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610779360751.2149632518115; Tue, 22 Oct 2024 08:26:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkb-0007pi-NB; Tue, 22 Oct 2024 11:24:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkU-0007iQ-OZ for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkR-0004zt-UB for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:41 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-1qWVszDQOluKTCO8uEZrUA-1; Tue, 22 Oct 2024 11:24:36 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C06A1977013; Tue, 22 Oct 2024 15:24:34 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A81911956046; Tue, 22 Oct 2024 15:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xg+/wJ8KaQvUaWOc4vR3Cy3gH+8WYWyHSb5gAzBFwzU=; b=ckDsd1mB9xewr8wPyE7lJs9xtFUV73zLYthDfxIOzVOiS826xIGdsq6nHa2rcqnG86hr43 fkVCGIuZo8mWYQHnrmuldVmKtXe3r4fb9xqn+zkjfvS0DxLndGwP7czoZ68BSesG43EBPX Q8vEjzmWUcH17KHbEEiT5pSYYBvRvnA= X-MC-Unique: 1qWVszDQOluKTCO8uEZrUA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dorjoy Chowdhury Subject: [PULL 05/14] tests: correctly validate result buffer in hash/hmac tests Date: Tue, 22 Oct 2024 16:24:06 +0100 Message-ID: <20241022152415.1632556-6-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.697, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610781212116600 Validate that the pre-allocated buffer pointer was not overwritten by the hash/hmac APIs. Reviewed-by: Dorjoy Chowdhury Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/unit/test-crypto-hash.c | 7 ++++--- tests/unit/test-crypto-hmac.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-crypto-hash.c b/tests/unit/test-crypto-hash.c index e5829ca766..76c4699c15 100644 --- a/tests/unit/test-crypto-hash.c +++ b/tests/unit/test-crypto-hash.c @@ -123,7 +123,7 @@ static void test_hash_prealloc(void) size_t i; =20 for (i =3D 0; i < G_N_ELEMENTS(expected_outputs) ; i++) { - uint8_t *result; + uint8_t *result, *origresult; size_t resultlen; int ret; size_t j; @@ -133,7 +133,7 @@ static void test_hash_prealloc(void) } =20 resultlen =3D expected_lens[i]; - result =3D g_new0(uint8_t, resultlen); + origresult =3D result =3D g_new0(uint8_t, resultlen); =20 ret =3D qcrypto_hash_bytes(i, INPUT_TEXT, @@ -142,7 +142,8 @@ static void test_hash_prealloc(void) &resultlen, &error_fatal); g_assert(ret =3D=3D 0); - + /* Validate that our pre-allocated pointer was not replaced */ + g_assert(result =3D=3D origresult); g_assert(resultlen =3D=3D expected_lens[i]); for (j =3D 0; j < resultlen; j++) { g_assert(expected_outputs[i][j * 2] =3D=3D hex[(result[j] >> 4= ) & 0xf]); diff --git a/tests/unit/test-crypto-hmac.c b/tests/unit/test-crypto-hmac.c index 3fa50f24bb..cdb8774443 100644 --- a/tests/unit/test-crypto-hmac.c +++ b/tests/unit/test-crypto-hmac.c @@ -126,7 +126,7 @@ static void test_hmac_prealloc(void) for (i =3D 0; i < G_N_ELEMENTS(test_data); i++) { QCryptoHmacTestData *data =3D &test_data[i]; QCryptoHmac *hmac =3D NULL; - uint8_t *result =3D NULL; + uint8_t *result =3D NULL, *origresult =3D NULL; size_t resultlen =3D 0; const char *exp_output =3D NULL; int ret; @@ -139,7 +139,7 @@ static void test_hmac_prealloc(void) exp_output =3D data->hex_digest; =20 resultlen =3D strlen(exp_output) / 2; - result =3D g_new0(uint8_t, resultlen); + origresult =3D result =3D g_new0(uint8_t, resultlen); =20 hmac =3D qcrypto_hmac_new(data->alg, (const uint8_t *)KEY, strlen(KEY), &error_fatal); @@ -149,6 +149,8 @@ static void test_hmac_prealloc(void) strlen(INPUT_TEXT), &result, &resultlen, &error_fatal); g_assert(ret =3D=3D 0); + /* Validate that our pre-allocated pointer was not replaced */ + g_assert(result =3D=3D origresult); =20 exp_output =3D data->hex_digest; for (j =3D 0; j < resultlen; j++) { --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610791; cv=none; d=zohomail.com; s=zohoarc; b=iUZ46GWJMMSrJXpgpEA8VzeKApmbPlDcallqiPUTrPGBCSZujUkd4VQ+ycYYgtQc8NakyQOx8rUDTjkGX4KuCyXa72Qyz4ctRjFqn43zRkAksSd1AEQpuKHtMvlvsaXhA08yyzgsU2EcO7zH/vd2Qsfx3NehHveYuSnlC9Blmdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610791; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fCIjd5XoRAWklxpBwC1ESO697qS5sCLzfEo5E37CLA4=; b=Fa4aAFUUFi2NRZ85wiDxn6GDuV1BKzTZYC26C17hHLm0jYG7l/ukQGyKXQSye9UU3s9kzBOlrT1IIuKZF8N0IYO8wH4XQton4/MGBRt26/A79XceBbJ//8Fw/8f/MERLmWnu1aJIYotdDzx3Kga3OtGevjSIMWXI5/gIQAocvE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610791534544.554041695227; Tue, 22 Oct 2024 08:26:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkb-0007pa-LE; Tue, 22 Oct 2024 11:24:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkV-0007iX-5I for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkT-000500-0f for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:42 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-262-PVTZbQKBOumCMi9E6WTfhA-1; Tue, 22 Oct 2024 11:24:38 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3F65197700C; Tue, 22 Oct 2024 15:24:36 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7001B19560A2; Tue, 22 Oct 2024 15:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fCIjd5XoRAWklxpBwC1ESO697qS5sCLzfEo5E37CLA4=; b=EJNIdQGRXPP1HNrt+clHZJCcUTAZKVtfBn0W1jwRJzyZq4Z/aK2wsHjh5eJ4UHAxLLRPfX QYRPZYY5s7ylaFhYTEq/Ulcnij6PSHTofQh+K0je67QbV+5BzPrHbCL6B6v/t50f8F0GfD 9YH32UbhqwZDNd6f+ciOHgrVlnXd06E= X-MC-Unique: PVTZbQKBOumCMi9E6WTfhA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dorjoy Chowdhury Subject: [PULL 06/14] include/crypto: clarify @result/@result_len for hash/hmac APIs Date: Tue, 22 Oct 2024 16:24:07 +0100 Message-ID: <20241022152415.1632556-7-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610793363116600 The @result parameter passed to hash/hmac APIs may either contain a pre-allocated buffer, or a buffer can be allocated on the fly. Clarify these two different usage models in the API docs. Reviewed-by: Dorjoy Chowdhury Signed-off-by: Daniel P. Berrang=C3=A9 --- include/crypto/hash.h | 47 ++++++++++++++++++++++++++++++++----------- include/crypto/hmac.h | 34 ++++++++++++++++++++++--------- 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/include/crypto/hash.h b/include/crypto/hash.h index b791ca92a4..712cac79ee 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -73,11 +73,18 @@ size_t qcrypto_hash_digest_len(QCryptoHashAlgo alg); * @errp: pointer to a NULL-initialized error object * * Computes the hash across all the memory regions - * present in @iov. The @result pointer will be - * filled with raw bytes representing the computed - * hash, which will have length @resultlen. The - * memory pointer in @result must be released - * with a call to g_free() when no longer required. + * present in @iov. + * + * If @result_len is set to a non-zero value by the caller, then + * @result must hold a pointer that is @result_len in size, and + * @result_len match the size of the hash output. The digest will + * be written into @result. + * + * If @result_len is set to zero, then this function will allocate + * a buffer to hold the hash output digest, storing a pointer to + * the buffer in @result, and setting @result_len to its size. + * The memory referenced in @result must be released with a call + * to g_free() when no longer required by the caller. * * Returns: 0 on success, -1 on error */ @@ -98,11 +105,18 @@ int qcrypto_hash_bytesv(QCryptoHashAlgo alg, * @errp: pointer to a NULL-initialized error object * * Computes the hash across all the memory region - * @buf of length @len. The @result pointer will be - * filled with raw bytes representing the computed - * hash, which will have length @resultlen. The - * memory pointer in @result must be released - * with a call to g_free() when no longer required. + * @buf of length @len. + * + * If @result_len is set to a non-zero value by the caller, then + * @result must hold a pointer that is @result_len in size, and + * @result_len match the size of the hash output. The digest will + * be written into @result. + * + * If @result_len is set to zero, then this function will allocate + * a buffer to hold the hash output digest, storing a pointer to + * the buffer in @result, and setting @result_len to its size. + * The memory referenced in @result must be released with a call + * to g_free() when no longer required by the caller. * * Returns: 0 on success, -1 on error */ @@ -215,8 +229,17 @@ int qcrypto_hash_finalize_base64(QCryptoHash *hash, * * Computes the hash from the given hash object. Hash object * is expected to have it's data updated from the qcrypto_hash_update func= tion. - * The memory pointer in @result must be released with a call to g_free() - * when no longer required. + * + * If @result_len is set to a non-zero value by the caller, then + * @result must hold a pointer that is @result_len in size, and + * @result_len match the size of the hash output. The digest will + * be written into @result. + * + * If @result_len is set to zero, then this function will allocate + * a buffer to hold the hash output digest, storing a pointer to + * the buffer in @result, and setting @result_len to its size. + * The memory referenced in @result must be released with a call + * to g_free() when no longer required by the caller. * * Returns: 0 on success, -1 on error */ diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h index c69a0dfab3..da8a1e3ceb 100644 --- a/include/crypto/hmac.h +++ b/include/crypto/hmac.h @@ -77,11 +77,18 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoHmac, qcrypto_hmac= _free) * @errp: pointer to a NULL-initialized error object * * Computes the hmac across all the memory regions - * present in @iov. The @result pointer will be - * filled with raw bytes representing the computed - * hmac, which will have length @resultlen. The - * memory pointer in @result must be released - * with a call to g_free() when no longer required. + * present in @iov. + * + * If @result_len is set to a non-zero value by the caller, then + * @result must hold a pointer that is @result_len in size, and + * @result_len match the size of the hash output. The digest will + * be written into @result. + * + * If @result_len is set to zero, then this function will allocate + * a buffer to hold the hash output digest, storing a pointer to + * the buffer in @result, and setting @result_len to its size. + * The memory referenced in @result must be released with a call + * to g_free() when no longer required by the caller. * * Returns: * 0 on success, -1 on error @@ -103,11 +110,18 @@ int qcrypto_hmac_bytesv(QCryptoHmac *hmac, * @errp: pointer to a NULL-initialized error object * * Computes the hmac across all the memory region - * @buf of length @len. The @result pointer will be - * filled with raw bytes representing the computed - * hmac, which will have length @resultlen. The - * memory pointer in @result must be released - * with a call to g_free() when no longer required. + * @buf of length @len. + * + * If @result_len is set to a non-zero value by the caller, then + * @result must hold a pointer that is @result_len in size, and + * @result_len match the size of the hash output. The digest will + * be written into @result. + * + * If @result_len is set to zero, then this function will allocate + * a buffer to hold the hash output digest, storing a pointer to + * the buffer in @result, and setting @result_len to its size. + * The memory referenced in @result must be released with a call + * to g_free() when no longer required by the caller. * * Returns: * 0 on success, -1 on error --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610847; cv=none; d=zohomail.com; s=zohoarc; b=PSYTxh45mBVRO2qQYU3hNNJ70TCGCJU7t7iXHFE+NzryumhQJTBL1MKZc2lABwCJnC4wMwYeTda+ttbQMcdM1nyioNG6rINsCTI8gCCyao1670m8NLJf0E7T1VEpRqd90kcWILGQjinkJxogbjLOqBBp74FV50kWONurONDhSBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610847; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BokGzU5ocSxTIiJ9O/ulSdi5PZJ3j6wdadTlergfOL4=; b=jMqNs8X+wZOdyAxxuYtQgA43DghjSBoYlVnWjMepVBovVWz+aN65Mu28HeJvpBQVDGe7aKb8V1jsGdugY5sjI1r2efq3QUq82LViLGGl3wLOIlR2LsdlHK9vdGu8lSJ/CFioNhwLlyW2wAZ0oeKzcdM0vbOOJu9vS2kDSofxUrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610847521612.9329836209076; Tue, 22 Oct 2024 08:27:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkc-0007qO-2O; Tue, 22 Oct 2024 11:24:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkY-0007n8-Us for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3GkW-00050V-Of for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:46 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-BzrTUTlOOZ6ddqLQBzCE7w-1; Tue, 22 Oct 2024 11:24:40 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 993CE1977016; Tue, 22 Oct 2024 15:24:39 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 70EFF19560B2; Tue, 22 Oct 2024 15:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BokGzU5ocSxTIiJ9O/ulSdi5PZJ3j6wdadTlergfOL4=; b=Q2PaK1U7EDB6GBA9NqIO4EmeER1xppUWaGIZuhRJ0pQdegSAymxhDRU05fQ3+IJvzHy2L5 ap50rKwH0OYqK5jRK1dIqExALn5+H6yI6hqw0P4jI6GN4uXIikmx1VJqqTH2iemcQWmWHs nJsx6rExtKxM+5TYANk5f1CE1ymdJeA= X-MC-Unique: BzrTUTlOOZ6ddqLQBzCE7w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Markus Armbruster Subject: [PULL 07/14] crypto/hash-afalg: Fix broken build Date: Tue, 22 Oct 2024 16:24:08 +0100 Message-ID: <20241022152415.1632556-8-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.697, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610849532116600 From: Markus Armbruster Fux build broken by semantic conflict with commit 8f525028bc6 (qapi/crypto: Rename QCryptoAFAlg to QCryptoAFAlgo). Fixes: 90c3dc60735a (crypto/hash-afalg: Implement new hash API) Signed-off-by: Markus Armbruster Signed-off-by: Daniel P. Berrang=C3=A9 --- crypto/hash-afalg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c index 06e1e4699c..8c0ce5b520 100644 --- a/crypto/hash-afalg.c +++ b/crypto/hash-afalg.c @@ -142,7 +142,7 @@ QCryptoHash *qcrypto_afalg_hash_new(QCryptoHashAlgo alg= , Error **errp) static void qcrypto_afalg_hash_free(QCryptoHash *hash) { - QCryptoAFAlg *ctx =3D hash->opaque; + QCryptoAFAlgo *ctx =3D hash->opaque; =20 if (ctx) { qcrypto_afalg_comm_free(ctx); @@ -159,7 +159,7 @@ void qcrypto_afalg_hash_free(QCryptoHash *hash) * be provided to calculate the final hash. */ static -int qcrypto_afalg_send_to_kernel(QCryptoAFAlg *afalg, +int qcrypto_afalg_send_to_kernel(QCryptoAFAlgo *afalg, const struct iovec *iov, size_t niov, bool more_data, @@ -183,7 +183,7 @@ int qcrypto_afalg_send_to_kernel(QCryptoAFAlg *afalg, } =20 static -int qcrypto_afalg_recv_from_kernel(QCryptoAFAlg *afalg, +int qcrypto_afalg_recv_from_kernel(QCryptoAFAlgo *afalg, QCryptoHashAlgo alg, uint8_t **result, size_t *result_len, @@ -222,7 +222,7 @@ int qcrypto_afalg_hash_update(QCryptoHash *hash, size_t niov, Error **errp) { - return qcrypto_afalg_send_to_kernel((QCryptoAFAlg *) hash->opaque, + return qcrypto_afalg_send_to_kernel((QCryptoAFAlgo *) hash->opaque, iov, niov, true, errp); } =20 @@ -232,7 +232,7 @@ int qcrypto_afalg_hash_finalize(QCryptoHash *hash, size_t *result_len, Error **errp) { - return qcrypto_afalg_recv_from_kernel((QCryptoAFAlg *) hash->opaque, + return qcrypto_afalg_recv_from_kernel((QCryptoAFAlgo *) hash->opaque, hash->alg, result, result_len, e= rrp); } =20 --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610781; cv=none; d=zohomail.com; s=zohoarc; b=SIcAaDjjGNQRnb9Nw4BTjLoT59+lx2MhoMu+Q8yGzTB1DJkBXcyYOZSkbL+/iU/9E4TtthnJ1oNHrAQnjg5TPOQCpL6+lDqwzoi1EPHlggLBPIZi8rSgmF6nhHwjxYqb0q0oX4C9KiMmNPOY7pJXe249wIKYX0FAJuyIn2ZSfXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610781; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JhLwN1xcVc4bxUulw8IvjvSjWvFylTwzvGK5edzZaYw=; b=COJdjQUFspOlmRTxBp9Izq8qkAIQF+K0tn8t2lzeOGEU0wNSItAY2YQj1XsRpuK/M9PIXvIuozGF9d0j1ZpDT10wlFl/V7tC97ncD9RS5y58og7oHv02hKu0CB7Flo75gtmham8HbCYieJeG9zK2O9J6WJjZqOT+/hb42mTXH5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610781254180.12357714061545; Tue, 22 Oct 2024 08:26:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkf-0007wu-Su; Tue, 22 Oct 2024 11:24:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gke-0007wZ-OF for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkc-00050w-PP for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:52 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-156-WdCBgWN9ONmlhphBk2-8CA-1; Tue, 22 Oct 2024 11:24:44 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3D3B19332A9; Tue, 22 Oct 2024 15:24:42 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 096D419560A2; Tue, 22 Oct 2024 15:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JhLwN1xcVc4bxUulw8IvjvSjWvFylTwzvGK5edzZaYw=; b=ZDzQIZARvMVXdKoBRKCIh2Bkui+RFnllLj0T+TA6dHQbNYqoic1SQB6qxFpnr/PLXjE0xd 9jCOGMq8CuE8btRY2Z8FHv4Gtox8ACmVYDrX/K7Orcc6KXSqsNFHVsbBPbz57sM6895F43 yY/OHvCXRu27YriyK6YqtTElZGER67Y= X-MC-Unique: WdCBgWN9ONmlhphBk2-8CA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 08/14] ui/vnc: don't return an empty SASL mechlist to the client Date: Tue, 22 Oct 2024 16:24:09 +0100 Message-ID: <20241022152415.1632556-9-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610783251116600 The SASL initialization phase may determine that there are no valid mechanisms available to use. This may be because the host OS admin forgot to install some packages, or it might be because the requested SSF level is incompatible with available mechanisms, or other unknown reasons. If we return an empty mechlist to the client, they're going to get a failure from the SASL library on their end and drop the connection. Thus there is no point even sending this back to the client, we can just drop the connection immediately. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 47fdae5b21..7d9ca9e8ac 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -674,6 +674,13 @@ void start_auth_sasl(VncState *vs) } trace_vnc_auth_sasl_mech_list(vs, mechlist); =20 + if (g_str_equal(mechlist, "")) { + trace_vnc_auth_fail(vs, vs->auth, "no available SASL mechanisms", = ""); + sasl_dispose(&vs->sasl.conn); + vs->sasl.conn =3D NULL; + goto authabort; + } + vs->sasl.mechlist =3D g_strdup(mechlist); mechlistlen =3D strlen(mechlist); vnc_write_u32(vs, mechlistlen); --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610847; cv=none; d=zohomail.com; s=zohoarc; b=no7Lnk6dEMSZodDqoLNKZf1z/GecaZShBWgVx+v28m35SbD1N0wuimh1liMrS4ht6vR9tzXqyIOrk+yn7cRewFi2PaSOvkMR3+bXgBlYfIOSJ/hGZMOqN6bMPmd7/iGY5I3/8hfKLzgKMJRcxOSp4R0ULLsvlnud+tapI+Z2kKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610847; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oGXtD59Wdl4rms+4dg7aanApiesZPcqhLbJOgYZq2lc=; b=ecmi3XcI8GDDlduWp8l2RASVafU4CxLpFjs8iFsd2tOEatCxlLEbe4KMmczHW5tLevD1MYtMkGrn46UZ58ewxLphzMV46K/0TPDPrh4x7JbwDLIEEpSD9iiE7Z1GluJct3vHl7FtzwjZjVnpcaHcVpfxHB1VmpRRZpGGHPpNpHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610847557498.7225447658609; Tue, 22 Oct 2024 08:27:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkg-0007ww-FL; Tue, 22 Oct 2024 11:24:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gke-0007wa-OF for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkd-000515-Cz for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:52 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-424-Nb49rNgQNbudWibbO21aTQ-1; Tue, 22 Oct 2024 11:24:46 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 698011977323; Tue, 22 Oct 2024 15:24:45 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3EDED1956046; Tue, 22 Oct 2024 15:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGXtD59Wdl4rms+4dg7aanApiesZPcqhLbJOgYZq2lc=; b=VO98N8vD4Yg+RoBs/CJDjYH+T6I3OixCTJ9jifDognDa9s55kmXKg34jw4S2KsRQEi70K8 fwpDQthXwkQkULy6dIXD6bzmO6z8wZIRzKljVQn2/LMyh78xqlpMTha0vi94+Z1eK+cdl7 1tK4JuhOT5nCts/yMn7vdyrorLbqjVg= X-MC-Unique: Nb49rNgQNbudWibbO21aTQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 09/14] ui/vnc: don't raise error formatting socket address for non-inet Date: Tue, 22 Oct 2024 16:24:10 +0100 Message-ID: <20241022152415.1632556-10-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610849570116600 The SASL library requires the connection's local & remote IP address to be passed in, since some mechanism may use this information. Currently QEMU raises an error for non-inet sockets, but it is valid to pass NULL to the SASL library. Doing so makes SASL work on UNIX sockets. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 7d9ca9e8ac..edf19deb3b 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -524,13 +524,13 @@ static int protocol_client_auth_sasl_mechname_len(Vnc= State *vs, uint8_t *data, s return 0; } =20 -static char * +static int vnc_socket_ip_addr_string(QIOChannelSocket *ioc, bool local, + char **addrstr, Error **errp) { SocketAddress *addr; - char *ret; =20 if (local) { addr =3D qio_channel_socket_get_local_address(ioc, errp); @@ -538,17 +538,17 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc, addr =3D qio_channel_socket_get_remote_address(ioc, errp); } if (!addr) { - return NULL; + return -1; } =20 if (addr->type !=3D SOCKET_ADDRESS_TYPE_INET) { - error_setg(errp, "Not an inet socket type"); + *addrstr =3D NULL; qapi_free_SocketAddress(addr); - return NULL; + return 0; } - ret =3D g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port); + *addrstr =3D g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.= port); qapi_free_SocketAddress(addr); - return ret; + return 0; } =20 void start_auth_sasl(VncState *vs) @@ -561,15 +561,15 @@ void start_auth_sasl(VncState *vs) int mechlistlen; =20 /* Get local & remote client addresses in form IPADDR;PORT */ - localAddr =3D vnc_socket_ip_addr_string(vs->sioc, true, &local_err); - if (!localAddr) { + if (vnc_socket_ip_addr_string(vs->sioc, true, + &localAddr, &local_err) < 0) { trace_vnc_auth_fail(vs, vs->auth, "Cannot format local IP", error_get_pretty(local_err)); goto authabort; } =20 - remoteAddr =3D vnc_socket_ip_addr_string(vs->sioc, false, &local_err); - if (!remoteAddr) { + if (vnc_socket_ip_addr_string(vs->sioc, false, + &remoteAddr, &local_err) < 0) { trace_vnc_auth_fail(vs, vs->auth, "Cannot format remote IP", error_get_pretty(local_err)); g_free(localAddr); --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610714; cv=none; d=zohomail.com; s=zohoarc; b=DkxjOcP1SmgsuPIX5eIM7z7MvarHxWZh0FQlzrGY7zbQXPPWUlOOx3PVQA7qKLesdAoS0IGPeWxW3xu1hX4hFptihZaF4JTnrzkg/QAdjI/9WqlDxKOmratKUjLoYncyPjOnmu0odFpxI0IUx3gCm7ygBxHIOtvlETuffFviGyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610714; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OsVg9LKAx4ynICHdhBCnNQId5jUOMnNKGUPWtgNz6/Q=; b=MXgWAA/pitI6U8lZTeELp9Qr2IWfmipz+H6kg0KxbbC72QW/Kt96P5D2svlB46c7KJGMqrdFjEXnn10pbsRnO0IDa7QsY/ufiW2JLZ/OZqn/I/hdLk/rn2IybzMg6XzGGd5izwqZLOjtvG0rJvKdS0EXKasItTtweta6jIxAYeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610714523968.6522195052437; Tue, 22 Oct 2024 08:25:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkk-00089s-GJ; Tue, 22 Oct 2024 11:24:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gki-000840-HO for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkg-00051o-Sh for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:56 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-CXrmnBCaNeW1lhg5fLeJJA-1; Tue, 22 Oct 2024 11:24:48 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C5EAD195421E; Tue, 22 Oct 2024 15:24:47 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CA3C51955F39; Tue, 22 Oct 2024 15:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OsVg9LKAx4ynICHdhBCnNQId5jUOMnNKGUPWtgNz6/Q=; b=HABNq4uGo/VJMDbiGR2NNPGlAMoVfdW7rziCwT4Kl08ndo2ImaatEP5mQArWgxfYTpAnr1 dKdRcp1f0mLq7pNsNtCynpqLMtmwbSQAYIJgDGEVHENW8nmByvJ0fa0PMiDxRjw0WYaDE2 bR4JTfHEFHH6nBeaUVdh4RpBlCPrG3g= X-MC-Unique: CXrmnBCaNeW1lhg5fLeJJA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 10/14] ui/vnc: fix skipping SASL SSF on UNIX sockets Date: Tue, 22 Oct 2024 16:24:11 +0100 Message-ID: <20241022152415.1632556-11-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.697, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610715694116600 The 'is_unix' flag is set on the VNC server during startup, however, a regression in: commit 8bd22f477f68bbd7a9c88e926e7a58bf65605e39 Author: Daniel P. Berrang=C3=A9 Date: Fri Feb 3 12:06:46 2017 +0000 ui: extract code to connect/listen from vnc_display_open meant we stopped setting the 'is_unix' flag when QEMU listens for VNC sockets, only setting when QEMU does a reverse VNC connection. Rather than fixing setting of the 'is_unix' flag, remove it, and directly check the live client socket address. This is more robust to a possible situation where the VNC server was listening on a mixture of INET and UNIX sockets. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 14 +++++++++++--- ui/vnc.c | 3 --- ui/vnc.h | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index edf19deb3b..43515447fb 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -551,6 +551,13 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc, return 0; } =20 +static bool +vnc_socket_is_unix(QIOChannelSocket *ioc) +{ + SocketAddress *addr =3D qio_channel_socket_get_local_address(ioc, NULL= ); + return addr && addr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX; +} + void start_auth_sasl(VncState *vs) { const char *mechlist =3D NULL; @@ -627,10 +634,11 @@ void start_auth_sasl(VncState *vs) memset (&secprops, 0, sizeof secprops); /* Inform SASL that we've got an external SSF layer from TLS. * - * Disable SSF, if using TLS+x509+SASL only. TLS without x509 - * is not sufficiently strong + * Disable SSF, if using TLS+x509+SASL only, or UNIX sockets. + * TLS without x509 is not sufficiently strong, nor is plain + * TCP */ - if (vs->vd->is_unix || + if (vnc_socket_is_unix(vs->sioc) || (vs->auth =3D=3D VNC_AUTH_VENCRYPT && vs->subauth =3D=3D VNC_AUTH_VENCRYPT_X509SASL)) { /* If we've got TLS or UNIX domain sock, we don't care about SSF */ diff --git a/ui/vnc.c b/ui/vnc.c index 93a8dbd253..5fcb35bf25 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3430,7 +3430,6 @@ static void vnc_display_close(VncDisplay *vd) if (!vd) { return; } - vd->is_unix =3D false; =20 if (vd->listener) { qio_net_listener_disconnect(vd->listener); @@ -3932,8 +3931,6 @@ static int vnc_display_connect(VncDisplay *vd, error_setg(errp, "Expected a single address in reverse mode"); return -1; } - /* TODO SOCKET_ADDRESS_TYPE_FD when fd has AF_UNIX */ - vd->is_unix =3D saddr_list->value->type =3D=3D SOCKET_ADDRESS_TYPE_UNI= X; sioc =3D qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "vnc-reverse"); if (qio_channel_socket_connect_sync(sioc, saddr_list->value, errp) < 0= ) { diff --git a/ui/vnc.h b/ui/vnc.h index e5fa2efa3e..acc53a2cc1 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -168,7 +168,6 @@ struct VncDisplay =20 const char *id; QTAILQ_ENTRY(VncDisplay) next; - bool is_unix; char *password; time_t expires; int auth; --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610781; cv=none; d=zohomail.com; s=zohoarc; b=kJpjiVjHWa6Uw2mJb0kXpnmW+me8tfAYxgPnS012cob6NVM4+miA1AUPYMVw45ghQnCv5V0ZY9zk4Mr5z4b2PZuRJjUM1NddIvTKpaZn7HxoqVkzFHknVpWK0MPl8OuMGtcntJGsOgH0NzSlIDEXKomgoQeWHjs82pb2ItZBF0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610781; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JHOoGMuBqmKoJxok+V5w6lrUb7P+Pey9YLVUauxf1VE=; b=XPloX5rVQRf1ToWrTqot4m4v8zaDNvENCsh5YqgQqK57jUp0YRNhHduGwZcIA8cxCRgrOCwDza4mDQiY497CPJ49YByLx1uBqB81uYRetnc9RutIhEX8cl4Bvn9cI11Dl2TxuDboOWyF5E4YLsajHkHGZZEQCSdGuoJ1lWF8dto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610781441797.3878168846935; Tue, 22 Oct 2024 08:26:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkm-0008Fi-D0; Tue, 22 Oct 2024 11:25:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkj-000891-MW for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkh-00051y-Cg for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:57 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-YSMR8js9OxSNANIZSCeGeQ-1; Tue, 22 Oct 2024 11:24:51 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3505B1944DE8; Tue, 22 Oct 2024 15:24:50 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 35D7419560A2; Tue, 22 Oct 2024 15:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JHOoGMuBqmKoJxok+V5w6lrUb7P+Pey9YLVUauxf1VE=; b=ZpU89xb8w+MZ6dAI8nRiCyfctZ/E8FTbg3XUtBev4zqxfx7LyIdz0qj1AF0ZzSjqa6HOgv qNLpOn4zYoA+JSG+1EeZlxLNHgkJzfE20vJdWRxivWQS3nhiRYxRCLc3hhV1AEuPpzHtB5 paq4K8+LjNpQ9GYuuQr5NIcNCo/lTTE= X-MC-Unique: YSMR8js9OxSNANIZSCeGeQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 11/14] ui/vnc: don't check for SSF after SASL authentication on UNIX sockets Date: Tue, 22 Oct 2024 16:24:12 +0100 Message-ID: <20241022152415.1632556-12-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610783252116600 Although we avoid requesting an SSF when querying SASL mechanisms for a UNIX socket client, we still mistakenly checked for availability of an SSF once the SASL auth process is complete. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 43515447fb..25f6b4b776 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -628,7 +628,7 @@ void start_auth_sasl(VncState *vs) goto authabort; } } else { - vs->sasl.wantSSF =3D 1; + vs->sasl.wantSSF =3D !vnc_socket_is_unix(vs->sioc); } =20 memset (&secprops, 0, sizeof secprops); --=20 2.46.0 From nobody Tue Oct 22 22:27:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610718; cv=none; d=zohomail.com; s=zohoarc; b=NQJx0j3ZFKMLdaEh+elNFzich/JmuEOvV9AC5JVKVrXqrDphnH2380HCouTqLAtVFgLi9/iWltLfPd4Jo8mE2LxlpL4t4oh4mVknw14yHNQ0sl4NH+BFgk3YZkPsmihuevHy9gBz/xz74bT+6hZP9ZCQHoFUUCuLE8ve1U08ltI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610718; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nZt2HKNUb5PfyAVwT+0TZxl+WowuzdEI4U/sbyJhCzs=; b=SMrpT3RqI3+QCqvH3uKFZy/2qorLsWa3MUr4LkfvRnsvC8bW99euuTA4FGAbWSEsb1xZgftjyUVFxHpb0P4iWLKz6L97wfJJ6XNTChZCTQyGwdgF+HCXnm/KqMmI4VCc9LuiqsscQ9VlfRL2pMgOMTWlmxuOcpEfS4SmbI7Nlx4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610717901191.51346183266662; Tue, 22 Oct 2024 08:25:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkp-0008RS-Im; Tue, 22 Oct 2024 11:25:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkm-0008FR-7C for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:25:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkk-00052V-GY for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:24:59 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-Ha-k4F5IOv25ZGvye_cFlw-1; Tue, 22 Oct 2024 11:24:53 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C9BD6193586C; Tue, 22 Oct 2024 15:24:52 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 97A7219560A2; Tue, 22 Oct 2024 15:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nZt2HKNUb5PfyAVwT+0TZxl+WowuzdEI4U/sbyJhCzs=; b=XUihSqvF/Xpx0BDDHec7LjE2pHFP0czp7JEZ/b5A7PnIDBNWEm52eko59PcAzqIyfMwf7K JT4T6pGG8r3iLnsO//GqCNr9qGHafZhfi1aFChcKvFIaAb+OdtRRDqg9PGi/XpgimaFdpq 75+5Eupd3aT/z0ZTneQ0XO7ua+h+Bqk= X-MC-Unique: Ha-k4F5IOv25ZGvye_cFlw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 12/14] ui: fix handling of NULL SASL server data Date: Tue, 22 Oct 2024 16:24:13 +0100 Message-ID: <20241022152415.1632556-13-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610718844116600 The code is supposed to distinguish between SASL server data that is NULL, vs non-NULL but zero-length. It was incorrectly checking the 'serveroutlen' variable, rather than 'serverout' though, so failing to distinguish the cases. Fortunately we can fix this without breaking compatibility with clients, as clients already know how to decode the input data correctly. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 25f6b4b776..a04feeb429 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -289,9 +289,10 @@ static int protocol_client_auth_sasl_step(VncState *vs= , uint8_t *data, size_t le goto authabort; } =20 - if (serveroutlen) { + if (serverout) { vnc_write_u32(vs, serveroutlen + 1); - vnc_write(vs, serverout, serveroutlen + 1); + vnc_write(vs, serverout, serveroutlen); + vnc_write_u8(vs, '\0'); } else { vnc_write_u32(vs, 0); } @@ -410,9 +411,10 @@ static int protocol_client_auth_sasl_start(VncState *v= s, uint8_t *data, size_t l goto authabort; } =20 - if (serveroutlen) { + if (serverout) { vnc_write_u32(vs, serveroutlen + 1); - vnc_write(vs, serverout, serveroutlen + 1); + vnc_write(vs, serverout, serveroutlen); + vnc_write_u8(vs, '\0'); } else { vnc_write_u32(vs, 0); } --=20 2.46.0 From nobody Tue Oct 22 22:27:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610751; cv=none; d=zohomail.com; s=zohoarc; b=jMLpp/iUCem7/4Q0seiowQ5qv8+SXSbiL2eR7ScCR55GMhcWFP8L4/VPpGIgNJ4NjuNINAl8/5bVMNhL64wazlCSZ3EKKG2Jc5vfIqNqcVLIkDnsoTjupStQcW1RKyDmL1ro7rpN1YtjESWEqLEJ0lYHKpZdq1kSpdmNhDzCDCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610751; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QOuPtrfxYuTQSyNiyUYfMZf4Fzl+Md7eAKoI2aBCov4=; b=JUbIx1GLF83Hie63m2vxvSIo3cnJs+LepOgXTy0SD62bbd4Ibx5fQ4wRQEO7PEqa+Djbtkf+4XcJ0k67hJdYRWCDuDZEWS9xC7TfXq/e0PIq2oKKhxEAnFW4UlavLgSphNkZ100vbCH/mEruRg0FQ828XvcWf2ezWM6OWdgRwK4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610751883658.916541266627; Tue, 22 Oct 2024 08:25:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gkt-0000AU-Ax; Tue, 22 Oct 2024 11:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkp-0008Sj-P8 for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:25:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkm-00052a-5w for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:25:01 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-nU8tbvqmMf68MNPwboR4fw-1; Tue, 22 Oct 2024 11:24:56 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3E8181953953; Tue, 22 Oct 2024 15:24:55 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3B79519560A2; Tue, 22 Oct 2024 15:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QOuPtrfxYuTQSyNiyUYfMZf4Fzl+Md7eAKoI2aBCov4=; b=efj01vhAi2zFIf24hsvmbPJ/ui6qV+7DrZoqQ4pOxxCGEU9vzKYqqd36BJiNr4kEBNoP6M 098pL4JxYDmvOrOsl2RlBnNtrc1eLU1F771n2dUQL1yuxsiJxHC2tUSFO3BBhZB8Ok8bkg pzLR72FnspQRdTW6Oe2S2Jrj62AESIo= X-MC-Unique: nU8tbvqmMf68MNPwboR4fw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 13/14] ui: validate NUL byte padding in SASL client data more strictly Date: Tue, 22 Oct 2024 16:24:14 +0100 Message-ID: <20241022152415.1632556-14-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610753130116600 When the SASL data is non-NULL, the SASL protocol spec requires that it is padded with a trailing NUL byte. QEMU discards the trailing byte, but does not currently validate that it was in fact a NUL. Apply strict validation to better detect any broken clients. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-auth-sasl.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index a04feeb429..3f4cfc471d 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -263,8 +263,14 @@ static int protocol_client_auth_sasl_step(VncState *vs= , uint8_t *data, size_t le /* NB, distinction of NULL vs "" is *critical* in SASL */ if (datalen) { clientdata =3D (char*)data; - clientdata[datalen-1] =3D '\0'; /* Wire includes '\0', but make su= re */ - datalen--; /* Don't count NULL byte when passing to _start() */ + if (clientdata[datalen - 1] !=3D '\0') { + trace_vnc_auth_fail(vs, vs->auth, "Malformed SASL client data", + "Missing SASL NUL padding byte"); + sasl_dispose(&vs->sasl.conn); + vs->sasl.conn =3D NULL; + goto authabort; + } + datalen--; /* Discard the extra NUL padding byte */ } =20 err =3D sasl_server_step(vs->sasl.conn, @@ -385,8 +391,14 @@ static int protocol_client_auth_sasl_start(VncState *v= s, uint8_t *data, size_t l /* NB, distinction of NULL vs "" is *critical* in SASL */ if (datalen) { clientdata =3D (char*)data; - clientdata[datalen-1] =3D '\0'; /* Should be on wire, but make sur= e */ - datalen--; /* Don't count NULL byte when passing to _start() */ + if (clientdata[datalen - 1] !=3D '\0') { + trace_vnc_auth_fail(vs, vs->auth, "Malformed SASL client data= ", + "Missing SASL NUL padding byte"); + sasl_dispose(&vs->sasl.conn); + vs->sasl.conn =3D NULL; + goto authabort; + } + datalen--; /* Discard the extra NUL padding byte */ } =20 err =3D sasl_server_start(vs->sasl.conn, --=20 2.46.0 From nobody Tue Oct 22 22:27:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1729610722; cv=none; d=zohomail.com; s=zohoarc; b=OJL7Bv0BrYt4jL/1KfjPqp6bAroIvpLpF+VDDj8ZxVxOqKvX7T/ww+9oGX3koFb4J7IffDXCjsJEdImoqAl2n5BuhKTsHkqj28TyMPU9oPoSnjS+9mAzn/uLplZfKqj47OFoSExgN5DLwsom75swFLr5Ngu42CcsEFHS1MX47UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729610722; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sQoxsdWn2SRfhAXX0IZFk8vYaPk909vj77RNYASjDYU=; b=QSnjN1fVuMe6FKxfeHPwsHSkOHq9A1NQe6r2pMldn/a7FxczQL7BOSORJckD4AHlm4P+MeVyvN2ehHMz1C85UMjCmeixDCj4qTRPBZlUVZjRvfcliPRk1466hxn5SDZuenQP4t6MLRAMxCwNVQ9HB/t12OuSHiqGEz96UNRdNBs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729610722298510.345635281097; Tue, 22 Oct 2024 08:25:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Gku-0000BN-Vk; Tue, 22 Oct 2024 11:25:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkp-0008Sd-Nn for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:25:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3Gkm-00052d-HH for qemu-devel@nongnu.org; Tue, 22 Oct 2024 11:25:02 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-e7riT23uOw-dIDMptEizpA-1; Tue, 22 Oct 2024 11:24:58 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AB500197703F; Tue, 22 Oct 2024 15:24:57 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.59]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA69A19560A2; Tue, 22 Oct 2024 15:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729610699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sQoxsdWn2SRfhAXX0IZFk8vYaPk909vj77RNYASjDYU=; b=fGhZorQBhQ1cFRKHT0YtRQ5aQ4PTuFfYPP/PQOCjrYGLNH+KqqYwcRI3dQZNuJyz0nbtnu HVPU6Cm3IS5m+1yIgqWUda4tSQ8CT0F8e+eDyYFts9j7013vZE+fkzsTyFARxAGzVcC7sX DkFgOwsFJx/MSUN0wIBuiyAPijDJJbU= X-MC-Unique: e7riT23uOw-dIDMptEizpA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 14/14] gitlab: enable afalg tests in fedora system test Date: Tue, 22 Oct 2024 16:24:15 +0100 Message-ID: <20241022152415.1632556-15-berrange@redhat.com> In-Reply-To: <20241022152415.1632556-1-berrange@redhat.com> References: <20241022152415.1632556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.697, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1729610722923116600 The AF_ALG crypto integration for Linux is not being tested in any CI scenario. It always requires an explicit configure time flag to be passed to turn it on. The Fedora system test is arbitrarily picked as the place to test it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrang=C3=A9 --- .gitlab-ci.d/buildtest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 01e8470a69..f0cbdf1992 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -115,7 +115,7 @@ build-system-fedora: job: amd64-fedora-container variables: IMAGE: fedora - CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs + CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs --enabl= e-crypto-afalg TARGETS: microblaze-softmmu mips-softmmu xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-soft= mmu MAKE_CHECK_ARGS: check-build --=20 2.46.0