Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Problems with copy scenarios in digest algorithm #199

Open
liuyangNB opened this issue Mar 6, 2024 · 3 comments
Open

Bug: Problems with copy scenarios in digest algorithm #199

liuyangNB opened this issue Mar 6, 2024 · 3 comments

Comments

@liuyangNB
Copy link

static int uadk_e_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
{
.........
	if (t->sess) {
		params.numa_id = -1;
		t->setup.sched_param = &params;
		t->sess = wd_digest_alloc_sess(&t->setup);
		if (!t->sess) {
			fprintf(stderr, "failed to alloc session for digest ctx copy.\n");
			return 0;
		}
........

In the uadk_e_digest_copy function, if the to context applies for hardware resources to calculate digest, and the hardware instance value is exhausted during the copy process, applying for a session to the to context will return failure. The code logic here is to return an error, and the business will be interrupted.

Recurrence conditions: Construct a situation where the instance value is small, triggering the calculation of digets in flow mode. For example, yum reinstall git or SSL link building, multiple processes can be started in the background to exhaust the queue. It will report failed to alloc session for digest ctx copy, and the business will fail.

@gaozhangfei
Copy link
Collaborator

有简单的重新步骤么,看不太懂这个步骤

@liuyangNB
Copy link
Author

有简单的重新步骤么,看不太懂这个步骤

目前没有构造出这个命令,我看uadk_engine计算digest的时候,每次计算任务都是申请2个instance,如果这样的话,当instance设置为基数如3的时候,其他命令如openssl speed -evp md5 -multi 8 -bytes 1024 -seconds 100可以消耗instance值,保持每个设备的instance值为1,这个时候去做 yum reinstall git. 这时候能进uadk_e_digest_copy,但是是报“uadk failed to initialize digest“ 错误。之后看看考虑下其他构造场景。

@gaozhangfei
Copy link
Collaborator

#203
我这边重现不了,不知道怎么进入copy, apt-get reinstall git 没有调用digest
这个rfc 有帮助么,就是加一个refcnt, 假设copy的时候,直接赋值了指针,即指向同一个sess, 可以对之前的refcnt++,释放的时候根据refcnt 实际释放。
我这边没验证copy那块。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants