From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 088F6A00C5; Thu, 30 Apr 2020 10:41:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7D5A1D9A3; Thu, 30 Apr 2020 10:41:58 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 5D9821D979 for ; Thu, 30 Apr 2020 10:41:57 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id r26so923387wmh.0 for ; Thu, 30 Apr 2020 01:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=UVua/qCIX6y2GM/aOCOmRZpZLd2QLq5AglIzyyAYBTA=; b=YrUPqVFPose6vcKitvb1XqTv5bLMoUltr5IM1CmIbBvACkLwzQFM8TjMA3Zl/kgIfs FlfVKQJswQu7q3cd/HAJOL0ABvVvlOAhYWE9w6GBKMAW7l4SM6Z+rxPvMF1LVlvvgFip Rr/E9EZQRi1KrB579SBlnlU9mhlRiZZMYCbWx9UWaZhRlPgx1VQ0+QljLuSLxrjMAso4 byNG0tq2U/eC/Y4lh+LFYBjSIQvFSv6XJd3BLsGoA1wGmJTN/3QeoT0p6ppEd1mwsCh2 CoQlUQk0fYUOxzxag+clui5O/wBDjZfJugNzxUxSU5aosuo74cq0nxQfo+mXo/6Uj7xF EFFA== X-Gm-Message-State: AGi0PubbTdNQdctLDECG3KyzPWt9Y0oOGfzaYqSq8+cxt8vQBlfFQIFx 0eMHRwVHBTFg/52J8RVMwHM= X-Google-Smtp-Source: APiQypI0sPYAQvTlwIKvKLjA/1JnAzbr0kEVLjqBlU6tyS1vn3pF9+IL4BPHVakh5Q+Hp0cB5yxUHA== X-Received: by 2002:a1c:7d04:: with SMTP id y4mr1737423wmc.10.1588236116829; Thu, 30 Apr 2020 01:41:56 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o7sm10936494wmh.46.2020.04.30.01.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 01:41:56 -0700 (PDT) Message-ID: From: Luca Boccassi To: Dan Gora Cc: Mattias =?ISO-8859-1?Q?R=F6nnblom?= , "dev@dpdk.org" , David Marchand , Jerin Jacob Date: Thu, 30 Apr 2020 09:41:55 +0100 In-Reply-To: References: <20200421195446.1730-1-dg@adax.com> <20200421195446.1730-3-dg@adax.com> <5df15087-781e-d27f-b7d8-50b1b8cb0c94@ericsson.com> <80e5cf97-feae-c753-5c65-4f3b121729f3@ericsson.com> <9782db5b1e5d2dfdcfa8e52410fd166df5db938d.camel@debian.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/2] eal: resolve getentropy at run time for random seed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 2020-04-27 at 13:57 -0300, Dan Gora wrote: > On Mon, Apr 27, 2020 at 1:19 PM Luca Boccassi wrote: > > On Thu, 2020-04-23 at 14:38 -0300, Dan Gora wrote: > > > On Thu, Apr 23, 2020 at 12:59 PM Luca Boccassi wro= te: > > > > > > /dev/urandom is basically only a different interface to the sam= e > > > > > > underlying mechanism. > > > >=20 > > > > This is not the whole story though - while the end result when all > > > > works is the same, there are important differences in getting there= . > > > > There's a reason a programmatic interface was added - it's just bet= ter > > > > in general. > > > > Just to name one - opening files has implications for LSMs like > > > > SELinux. You now need a specific policy to allow it, which means > > > > applications that upgrade from one version of DPDK to the next will > > > > break. > > >=20 > > > DPDK opens _tons_ of files. This would not be the first file that DPD= K > > > has to open. And it's not like /dev/urandom is a new interface. It'= s > > > been around forever. > >=20 > > That might be the case, but it is not reason in itself to make things > > harder. Especially in light of the new stability promise - this might > > or might not be considered part of it, but it's worth mentioning at the > > very least, as it has a real impact on users. >=20 > "make things harder" seems especially subjective.. I would argue that > I am in fact making things much easier by removing unnecessary > dependecies For someone with selinux, things would be harder. It's a consequence worth highlighting, that's all. > > > If this is such a major problem, then that would argue for using the > > > dlsym()/dlopen() method to try to find the getentropy glibc function > > > that I sent in v3 of these patches. > > >=20 > > > > In general, I do not think we should go backwards. The programmatic > > > > interface to the random pools are good and we should use them by > > > > default - of course by all means add fallbacks to urandom if they a= re > > > > not available. > > >=20 > > > The original problem was that the "programmatic interface to the > > > random pools" (that is, getentropy()) can only be determined at > > > compilation time and if found introduce a new dependency on glibc 2.2= 5 > > > that can easily be avoided by emulating it (as I did here in v4 of th= e > > > patches) or by trying to dynamically find the symbol at run time usin= g > > > dlopen()/dlsym() (as I did in v3 of the patches). > > >=20 > > > > But as Stephen said glibc generally does not support compiling on n= ew + > > > > running on old - so if it's not this that breaks, it will be someth= ing > > > > else. > > >=20 > > > Well that's not necessarily true. Most glibc interfaces have been > > > around forever and you can easily see what versions of glibc are > > > needed by running ldd on your application. I don't see the point in > > > introducing a new dependency on a very recent version of glibc which > > > is not supported by all supported DPDK platforms when it can easily b= e > > > worked around. > > >=20 > > > The issue here is that the original patch to add getentropy(): > > > 1) Added a _new_ dependency on glibc 2.25. > > > 2) Added a _new_ dependency that the rdseed CPU flag on the execution > > > machine has to match the complication machine. > > > 3) Has different behavior if the DPDK is compiled with meson or with > > > Make on the same complication platform. > > >=20 > > > thanks, > > > dan > >=20 > > Adding a new dependecy happens only when building with the new version > > of the library. If it's not available, then there's no new dependency. >=20 > But you also do not get to use the new getentropy() if you happen to > compile on a system which does not have the latest glibc, or if you > use the makefile system.. And that's perfectly fine - backward compatibility workarounds are not a problem to me. > > It sounds to me like you are trying to add workarounds for issues in > > your downstream build/deployment model, where your build dependencies > > are newer than your runtime dependencies. This in general is rarely > > well supported. >=20 > I am fully aware of that. I am not adding "workarounds", I am > eliminating unnecessary dependencies which probably never should have > been introduced in the first place. It's not unnecessary. It's a better interface, and worth using if available. > > Now I'm fine with adding workarounds as _fallbacks_ - what I am > > explicitly NACKing is forcibly restricting to the least common > > denominator because of issues in a third party build/deployment system > > that doesn't follow the common norm. >=20 > ugh.. this is the exact _opposite_ of what this patch does. It is not > restricting anything to a least common denominator. It is allowing > the DPDK to use the "best" available function, regardless of the build > system. >=20 > Restricting to the least common denominator is what the original patch di= d... This is restricting to the least common denominator of /dev/urandom, which is a bad interface, frail with issues that everybody is moving away from, in favour of the programmatic API that this patch is removing, in order to fix a corner case with a non-standard, third- party build system that downgrades dependencies at runtime vs build time. > > This is especially true when dealing with RNG APIs, where the tiniest > > and most innocent-looking mistake could have disastrous consequences. >=20 > This does not change the functionality of the RNG at all. It just > makes it work in the way that it was intended. These changes were > only introduced into 19.08, so they are not historical artifacts or > anything. It's reimplementing a syscall using a different interface which has different semantics. A small mistake there is going to cost us dearly. --=20 Kind regards, Luca Boccassi