On Fri, Sep 12, 2025 at 11:04:08AM -0000, Stuart Henderson wrote:
> On 2025-09-11, Tom Smyth <[email protected]> wrote:
> > Folks,
> > has anyone come across an issue with 7.6 and 7.7 OpenBSD where bgpd
> > process (the one running as root is running at a high cpu load
> >
> > see top -S and ps-aux output below, and bgp summary ...
> >
> > the number of messages seem to be low
> >
> > there are no errors or unusal messages in /var/log/daemon
> >
> > load averages:  1.07,  1.02,  0.92
> >                                              ntu-gen4- 20:09:05
> > 68 processes: 66 idle, 2 on processor
> >                                                           up 0 days
> > 00:38:54
> > CPU0 states: 20.9% user,  0.0% nice, 35.2% sys,  2.4% spin,  0.0%
> > intr, 41.4% idle
> > CPU1 states: 14.9% user,  0.0% nice, 28.5% sys,  0.8% spin,  0.0%
> > intr, 55.8% idle
> > Memory: Real: 63M/336M act/tot Free: 3554M Cache: 162M Swap: 0K/0K
> >
> >   PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
> > 10792 root      64    0 1660K 1716K onproc/0  -        38:35 99.02% bgpd
> 
> You might get clues from ktrace:
> 
> ktrace -p 10792; sleep 1; ktrace -C
> kdump > somefile
> 

I suggested the same to Tom and he already provided me with the kdump.
The fix for this issue is on tech@
https://marc.info/?l=openbsd-tech&m=175767683506055&w=2
and below

-- 
:wq Claudio

Index: pfkey.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/pfkey.c,v
diff -u -p -r1.72 pfkey.c
--- pfkey.c     27 Feb 2025 14:03:32 -0000      1.72
+++ pfkey.c     12 Sep 2025 11:27:44 -0000
@@ -453,13 +453,15 @@ pfkey_reply(int sd, uint32_t *spi)
 
        if (hdr.sadb_msg_errno != 0) {
                errno = hdr.sadb_msg_errno;
+
+               /* discard error message */
+               if (read(sd, &hdr, sizeof(hdr)) == -1)
+                       log_warn("pfkey read");
+
                if (errno == ESRCH)
                        return (0);
                else {
                        log_warn("pfkey");
-                       /* discard error message */
-                       if (read(sd, &hdr, sizeof(hdr)) == -1)
-                               log_warn("pfkey read");
                        return (-1);
                }
        }

Reply via email to