Skip to content

add freecertchain function, read certificates as cert chain in smtpd and pop3#23

Open
hahahahacker2009 wants to merge 14 commits into0intro:mainfrom
hahahahacker2009:certchain
Open

add freecertchain function, read certificates as cert chain in smtpd and pop3#23
hahahahacker2009 wants to merge 14 commits into0intro:mainfrom
hahahahacker2009:certchain

Conversation

@hahahahacker2009
Copy link

No description provided.

rsc and others added 10 commits February 28, 2026 15:50
1. Once a second rebalance() is called on cpu0 to adjust priorities,
so cpu-bound processes won't lock others out.  However it was only
adjusting processes which were running on cpu0.  This was observed
to lead to livelock, eg when a higher-priority process spin-waits
for a lock held by a lower priority one.

Reference: /n/sources/patch/proc-smp-fixes
Date: Tue Apr 19 13:42:06 CES 2016
Signed-off-by: miller@hamnavoe.com
If a process is started with RFNOWAIT, up->parent points to the parent's
Proc but up->parentpid is set to 0 (not the parent's actual pid).  If the
parent exits before the child, its pid becomes 0, and when the child exits
later, this code

		p = up->parent;
		....
		/*
		 * Check that parent is still alive.
		 */
		if(p->pid == up->parentpid && p->state != Broken) {

incorrectly treats the parent as still alive (because up->parent->pid and
up->parentpid are both zero).  So the exiting child's wait record is
passed to the dead parent ... or worse, if another fork occurs soon which
reuses the parent's Proc, we have a race which can pass the child's
wait record to some random new process (and decrement its p->nchild field).
This results in a "no living children" error if the new process tries
to wait for its real children.

The correction is to avoid the above check when up->parentpid == 0.

Reference: /n/sources/patch/exit-wrong-parent
Date: Thu Apr  5 21:37:43 GMT 2018
Signed-off-by: miller@hamnavoe.com
Plan 9 sysexec clears pending notes (unlike posix which leaves pending
signals active across exec).  So if fork+exec is followed immediately
by postnote("kill"), there is a window in sysexec between the last sleep
and the clearing of up->nnote where the note from the parent can be lost.
This also triggers another bug: exec clears up->nnote but does not clear
up->notepending, and therefore the first system call in the child
process which calls sleep() will be wrongly terminated with Eintr.

The parent process can detect when the child's exec has succeeded,
by opening a close-on-exec file before the fork, and waiting for
it to be closed before sending a note.  (The Go language runtime,
for example, does this.)  To eliminate the exec-postnote race in
this case, this patch moves the close-on-exec code to a later point
in the sysexec function, after pending notes have been cleared.

The race could be eliminated more simply by not clearing up->nnote
on exec, but that would change the semantics of exec and possibly
disturb some existing programs.

Reference: /n/sources/patch/exec-postnote-race
Date: Thu Apr  5 13:36:20 GMT 2018
Signed-off-by: miller@hamnavoe.com
From: cinap_lenrek <cinap_lenrek@felloff.net>
Date: Sat, 25 Sep 2021 20:35:04 +0000
Subject: [PATCH] devtls: fix bwrite memory leak when channel stops being open

tlsbwrite() would call checkstate() before calling tlsrecwrite()
to make sure the channel is open. however, because checkstate()
only raises the error, the Block* passed wont be freed and
would result in a memory leak.

move the checkstate() call inside tlsrecwrite() to reuse the
error handling that frees the block on error.
commit a4c1f3cc18df6fddd548f4df9f209695c4eb7263
Author: cinap_lenrek <cinap_lenrek@felloff.net>
Date:   Tue Nov 9 01:46:13 2021 +0000

    devtls: reject zero length records (thanks sigrid)

    zero length record causes ensure() todo nothing,
    while qgrab() assumes there is at least one buffer
    in the queue and would dereference the nil buffer.
@hahahahacker2009
Copy link
Author

@0intro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants