try the attached patch

On Mon, Feb 21, 2022 at 5:14 PM Michael Jung <mi...@paymentallianceintl.com>
wrote:

>
>
>
>
>
> CONFIDENTIALITY NOTE: This message is intended only for the use
> of the individual or entity to whom it is addressed and may
> contain information that is privileged, confidential, and
> exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution or copying
> of this communication is strictly prohibited. If you have
> received this transmission in error, please notify us by
> telephone at (502) 212-4000 or notify us at: PAI, Dept. 99,
> 2101 High Wickham Place, Suite 101, Louisville, KY 40245
>
>
>
> *From:* Michael Jung
> *Sent:* Monday, February 21, 2022 9:06 PM
> *To:* 'Hans Petter Selasky' <h...@selasky.org>; freebsd-current <
> freebsd-current@freebsd.org>
> *Subject:* RE: New panic in main-n253273-a52d8d4a6c6:
>
>
>
> *From:* Hans Petter Selasky [mailto:h...@selasky.org <h...@selasky.org>]
> *Sent:* Monday, February 21, 2022 8:34 PM
> *To:* Michael Jung <mi...@paymentallianceintl.com>; freebsd-current <
> freebsd-current@freebsd.org>
> *Subject:* Re: New panic in main-n253273-a52d8d4a6c6:
>
>
>
> On 2/22/22 00:42, Michael Jung wrote:
> > Hi:
> >
> > I was trying to remember what I did that was odd when this crash
> occurred then it
> > hit me. You can repeat this panic by doing:
> >
> > # watch -I -W pts/0
> >
> > Here is another panic that happened write after issuing "watch" for
> comparison.
> >
> > http://mail.mikej.com/core.txt.1
> >
> > http://mail.mikej.com/info.1
> >
> > http://mail.mikej.com/vmcore.1
> >
>
> I also need your kernel and debug kernel to fully debug this.
>
> 1) Do ssh to machine.
> 2) watch -i -W pts/0 (does not panic over here)
>
> Can you explain what step 1 is? An scp ?
>
> Refcount is -1.
> f_count = 0xffffffff
>
> f_data = 0xfffff800158b0400
>
> In your KGDB, can you enter:
>
> info 0xffffffff81b052d0
>
> Does the attached patch make any difference?
>
> --HPS
>
>
>
>
>
> So sorry, yes step one, ssh to machine….
>
>
>
> Even open a second console on the computer, no SSH and do “watch –I  -W
> v0” it panics.
>
>
>
> Example of “watch –I –W v0” for comparison – kernel/kernel.full have not
> changed since .2
>
>
>
> http://mail.mikej.com/core.txt.3
>
>
>
> http://mail.mikej.com/info.3
>
>
>
> http://mail.mikej.com/vmcore.3
>
>
>
>
>
>
>
>
> *Disclaimer*
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it. If you are not the recipient, you are hereby
> notified that any disclosure, copying, distribution or taking action in
> relation of the contents of this information is strictly prohibited and may
> be unlawful.
>
> This email has been scanned for viruses and malware, and may have been
> automatically archived by Mimecast, a leader in email security and cyber
> resilience. Mimecast integrates email defenses with brand protection,
> security awareness training, web security, compliance and other essential
> capabilities. Mimecast helps protect large and small organizations from
> malicious activity, human error and technology failure; and to lead the
> movement toward building a more resilient world. To find out more, visit
> our website.
>
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ebb32f698e88..e98b2d10b810 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -2083,6 +2083,8 @@ ttyhook_register(struct tty **rtp, struct proc *p, int fd, struct ttyhook *th,
 	FILEDESC_SLOCK(fdp);
 	error = fget_cap_locked(fdp, fd, cap_rights_init_one(&rights, CAP_TTYHOOK),
 	    &fp, NULL);
+	if (error == 0 && !fhold(fp))
+		return (EBADF);
 	FILEDESC_SUNLOCK(fdp);
 	if (error != 0)
 		return (error);

Reply via email to