From owner-freebsd-hackers@freebsd.org Sat May 1 09:29:40 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4ECA5F8BDA for ; Sat, 1 May 2021 09:29:40 +0000 (UTC) (envelope-from ionut.mihalache1506@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FXP8M5XMTz3sF6; Sat, 1 May 2021 09:29:39 +0000 (UTC) (envelope-from ionut.mihalache1506@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id m9so460608wrx.3; Sat, 01 May 2021 02:29:39 -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=yNNSdCvzpr6InWANqIJufpTtlQzpLjAdl0s8hV5Ge80=; b=VoPLxK54PGXOUgmNKSe9VY7vAnRkRYnkwv2/mQ8l78LD6qfHt3EjP01kRQUQCf3yi5 EHYW7M7FY/IVD+jE7erNkgbJ1rHAiKlDm0edDXGliLBes64tZ3S2W+2iCu9y8CguutGN dKMQLObvDhhy5T/coBaG+h+1tYY3lH6vCObWn6FmMe3MfoIdtc25VW01+ceLh+c7PBWI d3JU0N2fgTXdTFxLj/6Ku/eBa1tOXpk+1EdsIuaf6as+Hw6Zy3CpGk1xTGpjRZD8E74s KeRH56Jhi99T615jI7vVPQqgTtD6K+HqyxaPwq4NJrS2eVgpxmpnMivKoPzO8KSNUg11 J0eA== 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=yNNSdCvzpr6InWANqIJufpTtlQzpLjAdl0s8hV5Ge80=; b=sy3VTGmbtSJpxb4nzX4DislYZD4fibJZOU69srvBpsXsOY9wetwv9F3BS9bX5AXScD KNSnYmhJ+czrLCsC7D/SL9E1CF7hyePedpcg/nViR2xUWB9np6YmnOZlnH58EhPFZ06b TRpjrXxjn4wdUeHLbLdoR38U7vkdBB32jr8HRJ0/ACJYU/yBercVFkDtlpCsMP9rQlvM ThjfA2o3EBup2h6/bOKXfUe3zWEnzdYYCAQGPNePopcmjz7QTqNoj/PN2kCYmZu+qVnc /2Faz5UxcjcTKpeNSV+zy+j/iRmXJ12C7SYBBh1wMAt4hyUzEE7D0FAFpD7bPOlnMRo7 Xikw== X-Gm-Message-State: AOAM533wDXQw47fmocG15B6I+pg0sOUjTXC0hzD/YvPfE8YftTPRedls 1TkczUa1GesRcjJVPzAsgsczY8J7RVzxYWpKjJq8tM51Gcs= X-Google-Smtp-Source: ABdhPJxKUrmqxFkTI41D78NFa8YfbT3AKlaF+DJimghiUOMlFiWDXs1v3Q4Lp24c490PPZgmG5TWOxS2elfFnFI6ElU= X-Received: by 2002:a05:6000:1547:: with SMTP id 7mr13056619wry.388.1619861377838; Sat, 01 May 2021 02:29:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Ionu=C8=9B_Mihalache?= Date: Sat, 1 May 2021 12:29:26 +0300 Message-ID: Subject: Re: cap_sysctlbyname for hw.vmm.destroy To: Mark Johnston Cc: freebsd-hackers@freebsd.org X-Rspamd-Queue-Id: 4FXP8M5XMTz3sF6 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=VoPLxK54; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of ionutmihalache1506@gmail.com designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=ionutmihalache1506@gmail.com X-Spamd-Result: default: False [-1.47 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_MIXED_CHARSET(0.62)[subject]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::435:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_SPAM_SHORT(0.91)[0.907]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::435:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::435:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 May 2021 09:29:40 -0000 I did a clean buildworld with -DWITH_CASPER and -DHAVE_CASPER and now there is a linking problem. Here [1] I have the includes to test the example and here [2] I have the code. When trying to link there is a problem with cap_sysctl_limit_init, cap_sysctl_limit_name, cap_sysctl_limit, cap_sysctlbyname; the symbols are not found. If I comment those lines though, cap_service_open fails(this happens in bhyverun.c). When using the API here [3] there are no linking problems and cap_service_open works, but cap_sysctlbyname returns EPERM(I have here [4] the includes that I used). [1] - https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790= 17c025cbaf243/usr.sbin/bhyve/bhyverun.c#L36 [2] - https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790= 17c025cbaf243/usr.sbin/bhyve/bhyverun.c#L1569 [3] - https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790= 17c025cbaf243/lib/libvmmapi/vmmapi.c#L141 [4] - https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790= 17c025cbaf243/lib/libvmmapi/vmmapi.h#L38 =C3=8En mie., 28 apr. 2021 la 18:41, Mark Johnston a sc= ris: > On Wed, Apr 28, 2021 at 06:19:09PM +0300, Ionu=C8=9B Mihalache wrote: > > Even with the fixes cap_sysctl still returns EPERM for that simple > example. > > Are you sure that libcap_sysctl is actually being used? In other words, > are you compiling with -DWITH_CASPER? If not, the program will call > cap_enter() and then try to read the sysctl directly, since > cap_sysctlbyname() will be a simple wrapper for sysctlbyname(). > > > > > =C3=8En mie., 28 apr. 2021 la 17:41, Mark Johnston = a > scris: > > > > > There are two bugs in the example, also present in your WIP. I fixed > > > them here: > > > > > > > https://cgit.freebsd.org/src/commit/?id=3D44bbda649dc6c1cdc5a99641e14c771= 57967e140 > > > > > > On Wed, Apr 28, 2021 at 05:22:22PM +0300, Ionu=C8=9B Mihalache wrote: > > > > I update the code now [1] but still the same error. Even without an= y > > > limits > > > > the cap_sysctlbyname fails after using cap_enter. >