9front - general discussion about 9front
 help / color / mirror / Atom feed
* kernel: postnote patch
@ 2020-04-05  4:48 covertusername967
  0 siblings, 0 replies; 2+ messages in thread
From: covertusername967 @ 2020-04-05  4:48 UTC (permalink / raw)
  To: covertusername976, 9front

Currently, if you do a zero-sized write into the /proc/$pid/note file,
it will post the empty note successfully and cause the process to exit
with no status code.  This patch disables zero-sized note strings
altogether.

diff -r f3cc6939a481 sys/src/9/port/proc.c
--- a/sys/src/9/port/proc.c	Wed Apr 01 22:57:15 2020 +1030
+++ b/sys/src/9/port/proc.c	Sat Apr 04 23:31:39 2020 -0500
@@ -903,6 +903,9 @@
 		return 0;
 	}
 
+	if(strlen(n) == 0)
+		return 0;
+
 	if(n != nil && flag != NUser && (p->notify == nil || p->notified))
 		p->nnote = 0;



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: kernel: postnote patch
@ 2020-04-06 14:07 covertusername967
  0 siblings, 0 replies; 2+ messages in thread
From: covertusername967 @ 2020-04-06 14:07 UTC (permalink / raw)
  To: covertusername967, 9front

Here is a new version of the patch that checks the length of the note
string BEFORE aquiring the p->debug lock if dolock is set (thanks
kvik).

diff -r 8c47f4302b74 sys/src/9/port/proc.c
--- a/sys/src/9/port/proc.c	Sun Apr 05 23:26:52 2020 +0930
+++ b/sys/src/9/port/proc.c	Mon Apr 06 08:48:52 2020 -0500
@@ -894,6 +894,9 @@
 	if(p == nil)
 		return 0;
 
+	if(strlen(n) == 0)
+		return 0;
+
 	if(dolock)
 		qlock(&p->debug);
 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05  4:48 kernel: postnote patch covertusername967
2020-04-06 14:07 covertusername967

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).