From nobody Sun Mar 6 15:59:12 2022 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2003B19EC1B7 for ; Sun, 6 Mar 2022 15:59:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KBR9Q38W7z3wRx; Sun, 6 Mar 2022 15:59:22 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82e.google.com with SMTP id e2so11385549qte.12; Sun, 06 Mar 2022 07:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EsUxG7z62zVjz4qteqh50ZMyF9Vi8AOdglmPzcTrj98=; b=DRpPwGmhlTGwYkQM9lV7zaGiR+7s2BYrFtjoZAxXF1PDlTBebJvdfJESu2HhQWexiQ j8HFOij+3gVKjd5Qu6QTm8LUZUPUIWna0cK+rDkFxGCPvBFE1LZHiQ8PlZCMVp0jUNMH WxKIKAiMd5/4JlZO/UMx4w1hTTx2XmxQ3wFcP3YFH94ydqSrGqcteUEoO7P/NKCd0HO7 ix6doF/uLIcJNfk5+WNr/zeGSie1N+kZAuGQcDJr8Z1QPdkfV0TqlUNCpM/W+d4ntyp0 Vvm0wHshxCf28hebFL+h6LXSbcGoGLsjaTjwnmhN8q1U7v3hqPSXzCrFn0FtH4vwygHM B3kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=EsUxG7z62zVjz4qteqh50ZMyF9Vi8AOdglmPzcTrj98=; b=sI1aUaHpIGgjUlzyV3tUdCWGpizqsc5M/WXGdL9EFzp9P5fOh1zeQ1ImObVzfGfZMS 1uo6dNTzCPyrTm2DIvJKAwFkA1YTboqA6PFOYy/aSOTgZqZsCqwG1eTqC+ogHV4JsvTw 7g1aUt/GC0dqTOb+iBpXBJ+YsWS2l3tehpHEL/eixV9auWvYzCQpRXwwTXzo1gsNobP3 5wcUZQYHupEU+EO/aj9eBrYT1q2GLa1SPhdUAEMRIblcZyqqAoqnDQycMueHDzTID8Pn KIqerJZL7Z65nsUlsL6/iyKgGFQExxBIxKrztmoUGpu6zt2TDWS+7nPky0/nBno9g+00 PTog== X-Gm-Message-State: AOAM530IukSmJgC8nyb1JyAtLU3omTclZHwQXbKZKmqaoq6cyWlsvpYF hJ/DjT+m6zmWWzVs+CKlT+x5xqzSWW8= X-Google-Smtp-Source: ABdhPJxKAPPI6UCdlVfPAvHWc7m1CjipJZRE1R0vnb+EHEYx0dYhh0mT9FCHcIWxPJIatpYuOpxOWQ== X-Received: by 2002:ac8:5a03:0:b0:2de:2d44:b2ee with SMTP id n3-20020ac85a03000000b002de2d44b2eemr6395244qta.363.1646582355782; Sun, 06 Mar 2022 07:59:15 -0800 (PST) Received: from nuc (198-84-189-58.cpe.teksavvy.com. [198.84.189.58]) by smtp.gmail.com with ESMTPSA id g2-20020a37e202000000b00607e264a208sm5016482qki.40.2022.03.06.07.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Mar 2022 07:59:15 -0800 (PST) Date: Sun, 6 Mar 2022 10:59:12 -0500 From: Mark Johnston To: Peter Cc: Eugene Grosbein , freebsd-stable@freebsd.org, Konstantin Belousov Subject: Re: Program crashes on stable/13 (but not on 12.3) Message-ID: References: List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4KBR9Q38W7z3wRx X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=DRpPwGmh; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::82e as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-0.86 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-0.99)[-0.993]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_MEDIUM(0.78)[0.784]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.95)[-0.955]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82e:from]; MLMMJ_DEST(0.00)[freebsd-stable]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N On Sun, Mar 06, 2022 at 01:20:37AM +0100, Peter wrote: > On Sun, Mar 06, 2022 at 04:26:10AM +0700, Eugene Grosbein wrote: > ! 06.03.2022 2:26, Peter wrote: > ! > ! Adding kib@ to CC: in case this is connected to recent commit by him. > > It is. > > ! > Hija, > ! > > ! > this program crashes SEGV on stable/13 after 135962 iterations, > ! > but continues to run on 12.3. > ! > > ! > My stable/13 is still at 22ba2970766 - if You happen to be on a > ! > newer level, then please just try this out. > ! > > ! > ------------------------------------------------------ > ! > #include > ! > #include > ! > #include > ! > > ! > main() { > ! > char buf[] = "12345678901234567890123456789012345678901234567890"; > ! > int fd = open("/dev/null", O_RDONLY); > ! > int i = 0; > ! > > ! > close(1); > ! > dup2(fd, 1); > ! > close(fd); > ! > > ! > while(1) { > ! > fputs(buf, stdout); > ! > fflush(stdout); > ! > i++; > ! > fprintf(stderr, "%d\n", i); > ! > } > ! > } > ! > ------------------------------------------------------ > ! > > ! > I know that the code is bogus, but this is exactly what one of our > ! > ports does (and why it started to crash after upgrading to stable/13). > ! > > ! > And I think it should not SEGV, anyway. > ! > > ! > For the full story, read here: > ! > > ! > https://forums.freebsd.org/threads/random-program-crashes-no-coredumps-and-error-94.84285/ > ! > ! fflush() in our libc recently got some change due to very old PR > ! https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=76398 > ! > ! That change was merged to stable/13 after 13.0-RELEASE: > ! https://cgit.freebsd.org/src/commit/?id=afa9a1f5ec9974793a8744c55036ef5c4d08903d > > Yes, this is the cause, I now checked before and after. I don't really > see why it does what it does, even less why it only happens after so > many invocations. > > I wouldn't bother much about it, because such crappy code somehow > deserves to crash - but then, concerned is sysutils/bareos-client > backup tool, and arbitrary memory corruption appears there, and I > am not sure if this could lead to silently corrupted backup data. > So it's probably not the best idea to keep this into 13.1. This should be fixed by a recent commit to the main branch, and it'll make it into 13.1.