From owner-svn-src-all@freebsd.org Wed Mar 21 18:09:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D29AF596F5; Wed, 21 Mar 2018 18:09:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFF537E22A; Wed, 21 Mar 2018 18:09:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id k135-v6so8019796ite.2; Wed, 21 Mar 2018 11:09:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=649Cx6Ioe4VLdAi4UILCwFSKxOmS0S7mcjiyBWcoYOM=; b=AyQoEuSYMlsdNkR6TwHmN6YrK/NCtdIMdHIwvhvP0pF4KlmMJcwHhxj+q458nQma5O gvzrI7q7i0zW6M0GaY6mhBwI5byiun4TCphUGXHoHvzAedVFtdX+wry0CA+0k+q1O8L7 9RifgCIkIakNMkmzZPi6SkARNN6pd+dfL5gwAeWz13Ci03iaSk48j5wUk9aA5RCpyF24 ilylOpkMAuVwB2G9BlGEtAhYg0bGCYO45UbibojWBTYRm85oS8TiDaR8N4YS4ebvhPnH hco7IcydJuq3W1jFWJi5UqK3/yW04aWS119kr11zo8c7WrUZTYJ8F9EKEgfH6a0HW4fz 6m8Q== X-Gm-Message-State: AElRT7GBTTfWiC4zMw42c3o4tpfQK98e9fxct5Zxv7vINuSgu50VycTW XXP7pomEa6NtxfKeaxyR4SRCtRLV X-Google-Smtp-Source: AIpwx49o8NP+fTQfRrUJKfZSToidChZUFzn590uV7lEj1TszCzz9X8kHP2yRlnH8+IjeyNo+9A+DtQ== X-Received: by 2002:a24:496a:: with SMTP id z103-v6mr3228402ita.133.1521655770012; Wed, 21 Mar 2018 11:09:30 -0700 (PDT) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id m191-v6sm2060464itg.42.2018.03.21.11.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 11:09:29 -0700 (PDT) Received: by mail-it0-f48.google.com with SMTP id v194-v6so7868569itb.0; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) X-Received: by 2002:a24:82c1:: with SMTP id t184-v6mr5454758itd.61.1521655769679; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) In-Reply-To: References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 11:09:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Xin LI Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:09:32 -0000 Please see https://reviews.freebsd.org/D14785 . :-) Thanks, Conrad On Wed, Mar 21, 2018 at 10:31 AM, Xin LI wrote: > > > > On Wed, Mar 21, 2018 at 8:37 AM Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov >> wrote: >> > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov >> >> > Libraries must not abort the application. >> >> > Esp. libc. >> >> >> >> What do you propose instead? while (1); ? I don't see that as >> >> obviously better. >> > >> > Return the error to caller, as all, well most, correct library functions >> > do. >> >> The abort() in case of ENOSYS was proposed by delphij@. It is >> intended for users that getentropy() not fail. Another possible >> fallback is to use the kern.arandom sysctl. Would this be amenable to >> you? > > > My proposal was: "Note that ENOSYS should be handled by fallback with > kern.arandom or an explicit abort() should be done.". > > It seems that a more graceful way of doing this should be something like: > > if (sysctl({MIB: KERN, ARND}, 2, buf, &buflen_copy, NULL, 0) == -1 || > buflen_copy != buflen) { > /* > * The sysctl cannot fail. If it does fail on some FreeBSD > * derivative or after some future change, just abort so that > * the problem will be found and fixed. abort is not normally > * suitable for a library but makes sense here. > */ > abort(); > } > > Like it was done in srandomdev().