From owner-svn-src-head@freebsd.org Wed Mar 21 17:31:42 2018 Return-Path: Delivered-To: svn-src-head@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 0C23FF56A61; Wed, 21 Mar 2018 17:31:42 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (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 8E0187C5E7; Wed, 21 Mar 2018 17:31:41 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-io0-x244.google.com with SMTP id v13so7586883iob.6; Wed, 21 Mar 2018 10:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=ReQXEGoccz7wfX+W/UyKJNuf7x+uzBMV+EpCsq+kxL+Bh1CFtfBZQGp+hoNu7SBnIM dwpEHQo2Hi9FKxF6D81Ye5EVZX+0j1AHbAhdghDXCWjfkyFtgFn25cRVlEXZdveWu3pF cyUPjUGyX7lcfks0fARPjjkM6143NOS+tJPQNuwByqzMPyllSPtBUSdtGm/X9Dx9Vzu3 Kvi5w4Imb9iti+QQ/Pl4X58DYQDp7VOV9xnt6s5ycd5biK3Lu2CaaStgTIeXWWSkhnk9 Q2VRxPZe8yVYMWfYuefcZm8pNcPineVPoqCfcgIw0p0EB9L8ItskLVn651mU5HwJSGeh F/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=mK85Lly02m4CJTXmw9OBlPzi32VX49ydlSaDcWbcePVfuiL3bitnuVFVcFxO775C5H nrlHUrx4lU8wDIA5B0wPoUzVuLYM8eJDDRmUDtr9p6rKEDnh+PCKQXRDsB5JapPAm8V6 1FvX0cc7xY2QJmkgZgyA7pHa7d6mceUWVKIbF9nnpUpOFh2MhAzrt79Rr0zP5ac/zjgw X10RJI3xVhakPV4dnQkIuYIDl7SCJuHoWMhbDMLXZGP41McLkT3k/n/jcdbVor0Ci+FW WbaEOGT4CkD5wzbP5YHb1F5C1maQZ1uRDuyAhJ4OFeObBDRJn3AR/aJEtOcVhcbXp6MM pxJA== X-Gm-Message-State: AElRT7Fga5mqoyk276iMKp/4esvbBPAmuzVv/hqqdDB9ghZJHu0HCJ6K moPpCYgtQ+3xYjbaW7UHDUiYtcdPcUOMPujmPe/ykKtr X-Google-Smtp-Source: AG47ELvaSQkL65a7wq0sm5htsKOf7yMlibXoE29pdDwkS8eLPHRZuC2Z8RRBOnU4XuHkE7XEPZfo+UCI4pnz2nQDtjA= X-Received: by 10.107.242.7 with SMTP id q7mr21481066ioh.297.1521653500357; Wed, 21 Mar 2018 10:31:40 -0700 (PDT) MIME-Version: 1.0 References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> In-Reply-To: From: Xin LI Date: Wed, 21 Mar 2018 17:31:29 +0000 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: Conrad Meyer Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Xin Li Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:31:42 -0000 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 function= s > > 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? > =E2=80=8BMy proposal was: "Note that ENOSYS should be handled by fallback w= ith kern.arandom or an explicit abort() should be done.=E2=80=8B". 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) =3D=3D -1 || buflen_copy !=3D 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().