From ccc7705774918e4ae5367c3e8931765807e3931d Mon Sep 17 00:00:00 2001
From: Sergey Bugaev <bugaevc@gmail.com>
Date: Wed, 26 May 2021 19:19:36 +0300
Subject: console: Return EOPNOTSUPP when appropriate

We do not impement most of the mach_notify_* () routines. Explicitly return
an error code so that our caller knows to properly deallocate all resources
the messages may carry.

Even though we don't expect to receive some of the notifications from the kernel
as we never sign up for them, we can always receive spoofed notifications from
our clients, so don't abort in that case.
---
 console/display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'console/display.c')

diff --git a/console/display.c b/console/display.c
index f137a7a4..1336371d 100644
--- a/console/display.c
+++ b/console/display.c
@@ -318,7 +318,7 @@ do_mach_notify_port_deleted (struct port_info *pi, mach_port_t name)
 {
   /* As we cancel the dead-name notification before deallocating the
      port, this should not happen.  */
-  assert_backtrace (0);
+  return EOPNOTSUPP;
 }
 
 /* We request dead name notifications for the user ports.  */
@@ -369,7 +369,7 @@ do_mach_notify_dead_name (struct port_info *pi, mach_port_t dead_name)
 error_t
 do_mach_notify_port_destroyed (struct port_info *pi, mach_port_t rights)
 {
-  assert_backtrace (0);
+  return EOPNOTSUPP;
 }
 
 error_t
@@ -381,7 +381,7 @@ do_mach_notify_no_senders (struct port_info *pi, mach_port_mscount_t count)
 kern_return_t
 do_mach_notify_send_once (struct port_info *pi)
 {
-  return 0;
+  return EOPNOTSUPP;
 }
 
 kern_return_t
-- 
cgit v1.2.3