From owner-freebsd-hackers@freebsd.org Wed Apr 28 15:41:19 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 970C55F8114 for ; Wed, 28 Apr 2021 15:41:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 4FVjXZ5dqTz4nq5 for ; Wed, 28 Apr 2021 15:41:18 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72c.google.com with SMTP id q127so4799260qkb.1 for ; Wed, 28 Apr 2021 08:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=7ppnMoDutvPWgtUw1hTIP6z4cJLhF1HuwODEAA39ZHQ=; b=q7XeKOhB6eiyjB9Bw4APcijSLIPSOAEXY+ikbdrr1llI3KASGJSTMexvK93E4u6T0H tvDcoNUJ7vCrYLXRBl4NkeUFkWeH95sfpBvDEjUfO2uUJ2UUH1QisGppazvgwXtX7+HF X1D8s5eZwBUr/93xzFGV6zsgLsWYLrvVvQLaxuiLcAcfyL/P/hP2IVY7YX5Yk2I2ELGW KSHBjdyUDeJ+DXMAt19NGqB0eBw6xKOdJflAAjigOdVHvz8C7e38EEooDzr6T0UmOsCi 8pAq+Iwcjelr/be1hN6K9MzB+doeRtU2Su+cTCCGCee+wh7wdCsCgWxT+TkaoaJKzAIZ sU7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=7ppnMoDutvPWgtUw1hTIP6z4cJLhF1HuwODEAA39ZHQ=; b=f9r+uvBzgd32DBYRVnoon9F6PogrdStEaxU1NpZdqEuE6+lQdwYXjovx+AdV7tHWRi 5Gj7nJNWF4hguJAbhnQrcQogkKZ11NnH3ow7zT2n2QA+mkcbmJEhW5qMPQnVeRFpC7ao 1vIzwJFU+BBzMpMSgCC7wRZiAnxVSvfVPq5LnOB9TTbMgmHEigjjZd7G84qsvcyyB+2r RLugXfhUCAAKil86LwODePG2XxciH6OF2BQ7g5c0aEyDwemnsuRbatiZYCJLtP6tGppa TIOUz05Q+iTqcciufooDVH8wHC9IN4TrFuWajKZY9P09vCCs5+9PY4K4TIJ8sR7vpLxH XhHw== X-Gm-Message-State: AOAM532BfJv4bVHJLMgCdjmQW+9ge3J01DPpvFzOiI08Gpd5M6GQG8by y0biH04PE4d0rE2UuW2s5hs= X-Google-Smtp-Source: ABdhPJxwbZrYmONyuOHNGWtqdo19IU5CSIoQlayUoJTJvYpudy9Qh72SWXiP49MrnAr6hrlLPiSRfw== X-Received: by 2002:a05:620a:228b:: with SMTP id o11mr1612348qkh.489.1619624477554; Wed, 28 Apr 2021 08:41:17 -0700 (PDT) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id w4sm46813qkd.94.2021.04.28.08.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 08:41:17 -0700 (PDT) Sender: Mark Johnston Date: Wed, 28 Apr 2021 11:41:18 -0400 From: Mark Johnston To: =?utf-8?B?SW9udcib?= Mihalache Cc: freebsd-hackers@freebsd.org Subject: Re: cap_sysctlbyname for hw.vmm.destroy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4FVjXZ5dqTz4nq5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=q7XeKOhB; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::72c as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::72c:from]; 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]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::72c:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72c:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] 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: Wed, 28 Apr 2021 15:41:19 -0000 On Wed, Apr 28, 2021 at 06:19:09PM +0300, Ionuț 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(). > > În 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=44bbda649dc6c1cdc5a99641e14c77157967e140 > > > > On Wed, Apr 28, 2021 at 05:22:22PM +0300, Ionuț Mihalache wrote: > > > I update the code now [1] but still the same error. Even without any > > limits > > > the cap_sysctlbyname fails after using cap_enter.