From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 9 13:14:01 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B9951065680 for ; Wed, 9 Jun 2010 13:14:01 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4A82D8FC28 for ; Wed, 9 Jun 2010 13:14:00 +0000 (UTC) Received: by iwn7 with SMTP id 7so2346655iwn.13 for ; Wed, 09 Jun 2010 06:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type:content-transfer-encoding; bh=QZuzM3APgptd80cwQbgBFrVZuntXK8uHaM4WEYVYjL0=; b=Zwkl82YiWv1KHkDp+idizNWzTzpSOzltXg1dbTiGkMK4+o72o7pLVbNafjfz4HKqxV E6XgrcQvq1jKXSbcY2vr0GMb05giuDZEfPm1pLSeWaqSYsUDeq5CDsrei3QlwASB4pUm eWBJxdBtUuvFFj3sjWfyCNIPyzN6GF0DxRO/Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:openpgp:content-type :content-transfer-encoding; b=QWQ4q8A6Wmuc6BbIfJoOEW9MArKIvOdwwouvFx6wOJXxMlTUSwMTo4xyps11yvrBPC W4vt+au/RwY1EajU84/R7tOsuDD5CuVAzFzNwOcJS2vAtmQXhBycaeazv6Zc0ox+M8E8 9ITsLK32p2ywoIbbvGMtobWJXOn8IJzdSYIsk= Received: by 10.231.184.75 with SMTP id cj11mr3867289ibb.51.1276089240134; Wed, 09 Jun 2010 06:14:00 -0700 (PDT) Received: from centel.dataix.local (adsl-99-181-128-180.dsl.klmzmi.sbcglobal.net [99.181.128.180]) by mx.google.com with ESMTPS id b3sm30919006ibf.1.2010.06.09.06.13.57 (version=SSLv3 cipher=RC4-MD5); Wed, 09 Jun 2010 06:13:58 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4C0F9394.9030202@dataix.net> Date: Wed, 09 Jun 2010 09:13:56 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.9) Gecko/20100515 Thunderbird MIME-Version: 1.0 To: Ilya Bakulin References: <20100609121453.095d92b4@kibab.com> In-Reply-To: <20100609121453.095d92b4@kibab.com> X-Enigmail-Version: 1.0.1 OpenPGP: id=89D8547E Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: GSoC: registration of optional kernel features via sysctl: a question to the community X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2010 13:14:01 -0000 On 06/09/2010 04:14, Ilya Bakulin wrote: > Hi hackers! > > While discussing my project's implementation details with my mentor, > Alexander Leidinger, we've found that one of the ideas needs to be discussed with community, > to find out possible use cases. > That is, if it should be possible to spoof non-existing features. For > example, if currently running kernel doesn't support FreeBSD 5.0 compat > layer, "kern.features.compat_freebsd5" will be absent when querying > features list. The question is -- are there any cases when we want > "kern.features.compat_freebsd5" be present? If some feature is not in > kernel, then presenting its existence to the userland is useless > and may be even harmful, if, for example, some application relies on this feature. > Or there are some scenarios where such cheat is useful? > I can not think of any viable reason why one would want to "spoof" this when it is not available. To have this be present and set to a value of '0' would make sense for telling end-user program that its not available. Since a generic kernel is already built with the compatN layers that it supports I believe it would be best to look at __FreeBSD_version which should be kern.osreldate to see if that layer of compatibility is available at all and then leave it up to the end-user to enable it if they have built their own private kernel. Another thought that had come to mind was to make that sysctl an array of values for the layers of compatN that exist in the kernel. 1). Address [0] of the array is set to 1 if any compatN is available. 2). Further corresponding addresses 1 - N would correspond to _FREEBSD1 to FreeBSDN. "This is why COMPAT_FREEBSD32 is bad!" 3). If a compat version becomes unsupported set its array value to null. This would allow someone to be able to check against address [0] which should always exist and discontinue further checks to see what versions are available. Although it suggests subverting actually doing the work on the software writers part and checking against __FreeBSD_version to see what versions are available in a 'GENERIC' kernel. Just a thought but I would rather see an array of values than 3 - 4 separate sysctls. Kind regards & happy hacking, -- jhell