From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 00:11:48 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28CDC981; Sun, 12 Apr 2015 00:11:48 +0000 (UTC) Received: from mail-ig0-x22c.google.com (mail-ig0-x22c.google.com [IPv6:2607:f8b0:4001:c05::22c]) (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 02F00B84; Sun, 12 Apr 2015 00:11:47 +0000 (UTC) Received: by igbpi8 with SMTP id pi8so6687907igb.0; Sat, 11 Apr 2015 17:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=d1M7k4evNMsU4TGB7b4mpCzbMhrfBUOlg/EjDzSwcmo=; b=V42Rtm4x28vesRUxdnlipkwt/gdGqBPDWwsfAhgRL685/ve9ZOZfnwqYUJWUNG9M4U wys6TDjrtTK87F/TgzNDW3ZBm0S1+E7sDbJYFFXkhM7DVqkEfYVGiL5eUBq5Svd5GpQO QY1wy9XWn1vsvQlivSxDXrF6SaqwunqPhwqi4M9FTH9UMfCC1rPSox/eAegHg09Oxy0i rB7kSFh4NcMfcoX2qJQXZV83bw0j/B0LoqWrTygxpHvBrvz0dU4m0vNoJihDkbcMs/H5 jKJqWQfjujnbV/DPo2xWX4VgRreQiHg+q9r/MDMKzwSa9evedvHg84hvxIgr4fb2ylTM d04g== MIME-Version: 1.0 X-Received: by 10.42.137.202 with SMTP id z10mr11525295ict.37.1428797507346; Sat, 11 Apr 2015 17:11:47 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.17.194 with HTTP; Sat, 11 Apr 2015 17:11:47 -0700 (PDT) Date: Sat, 11 Apr 2015 17:11:47 -0700 X-Google-Sender-Auth: SxNU6A1b7DU9itycciBBxUrkVug Message-ID: Subject: using libgpio to bitbang LCDs! From: Adrian Chadd To: "freebsd-embedded@freebsd.org" , "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 00:11:48 -0000 Hi! I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial task: * convert C++ to C, which was done primarily to not rely on the arduino-isms; * use libgpio to bitbang the SPI bus needed to write to the LCD. It worked third time. First was "oh it runs on 5v power and 3.3v signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't set the pins to be output pins yet." Third time worked - just slowly. However - using libgpio was just pleasant. Get a handle, set the pin config, set the pins high/low. It was pretty damned wonderful. It turns out that to fill the screen with individual pixel writes takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000 syscalls a second. Ian's suggested something sensible - a bulk data ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one syscall, a big chunk of data with instructions and timings. The other interesting thing would be a kind of bulk pin set/get - ie, instead of doing rmw for one pin at a time, communicate down masks of pins to do together. There are some devices (eg these LCDs) that allow you to treat it as a 6800/8080 MCU and do 8 bit data reads/writes, so being able to do that via the GPIO interface would be nice. The arduino API doesn't do this, so people (and I'm not making this up) will bitshift a byte into different GPIO pin set/get, rather than use an 8 bit port as an 8 bit port. I'll put the code up soon in case anyone wants to start poking these embedded LCDs from FreeBSD. * = Carambola 2 (AR9331) with GPIO pins attached, to an Adafruit SSD1331 96x64 OLED display. From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 01:00:59 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73C56F31; Sun, 12 Apr 2015 01:00:59 +0000 (UTC) Received: from st11p00mm-asmtp003.mac.com (st11p00mm-asmtp003.mac.com [17.172.81.2]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A21DEE8; Sun, 12 Apr 2015 01:00:58 +0000 (UTC) Received: from akita.localnet (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by st11p00mm-asmtp003.mac.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Dec 4 2014)) with ESMTPSA id <0NMO00CQ05HEDJ00@st11p00mm-asmtp003.mac.com>; Sun, 12 Apr 2015 01:00:52 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-04-12_01:2015-04-10,2015-04-11,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=4 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1504120008 From: Rui Paulo To: freebsd-arch@freebsd.org Subject: Re: using libgpio to bitbang LCDs! Date: Sat, 11 Apr 2015 18:00:46 -0700 Message-id: <7527478.9HOi23WthO@akita> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-reply-to: References: MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset=us-ascii Cc: Adrian Chadd , "freebsd-embedded@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 01:00:59 -0000 On Saturday 11 April 2015 17:11:47 Adrian Chadd wrote: > Hi! > > I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial > task: > > * convert C++ to C, which was done primarily to not rely on the > arduino-isms; * use libgpio to bitbang the SPI bus needed to write to the > LCD. > > It worked third time. First was "oh it runs on 5v power and 3.3v > signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't > set the pins to be output pins yet." Third time worked - just slowly. > > However - using libgpio was just pleasant. Get a handle, set the pin > config, set the pins high/low. It was pretty damned wonderful. > > It turns out that to fill the screen with individual pixel writes > takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000 > syscalls a second. Ian's suggested something sensible - a bulk data > ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one > syscall, a big chunk of data with instructions and timings. Since this is an LCD, you probably want a way to export the GPIO bank via mmap with write-combining enabled. It's not really a safe operation as it could hang the GPIO driver, but it could be useful. > The other interesting thing would be a kind of bulk pin set/get - ie, > instead of doing rmw for one pin at a time, communicate down masks of > pins to do together. I think that's sensible and could be done via a separate (new) ioctl. -- Rui Paulo From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 06:45:56 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93617CA6; Sun, 12 Apr 2015 06:45:56 +0000 (UTC) Received: from mail-ie0-x233.google.com (mail-ie0-x233.google.com [IPv6:2607:f8b0:4001:c03::233]) (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 58FA5301; Sun, 12 Apr 2015 06:45:56 +0000 (UTC) Received: by iebrs15 with SMTP id rs15so44535776ieb.3; Sat, 11 Apr 2015 23:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=JRwVvgNvF81fcWRFUigX6ipMIrGM9KaAimL43dHSlpg=; b=AvUodDABkM38n4rmWqR1qLmBTgz2SEwxwzVOjFrAoeOUR+E+LpgziIA8BB8v4wyHJv 8S48OlykCcqOKu78t3ZA9V04ojB5HYlmPBn93GpGzDVJ7bixmph98hskRLCHfc/gAoyL yKVV8VyX3Ek+z3AQkxJgSyjmMM1a1NEk2aRX03a0avERDFyz1zedSIPy2qSBxa67X+PM cPPpus9khrRp+6n1j5s2v2c+RziB3oe7KkwjQrPpelg54TxKyI/9N5PkhlAJbV8VQ7Um Cd6Wwq2Ps/gnAy2mpthBLUou/yw7Kiv0IXX09Z3CmyLiRw/V3y9I3c3bqwTfQyZeExsj 2xSw== MIME-Version: 1.0 X-Received: by 10.107.136.25 with SMTP id k25mr12868628iod.88.1428821155725; Sat, 11 Apr 2015 23:45:55 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.17.194 with HTTP; Sat, 11 Apr 2015 23:45:55 -0700 (PDT) In-Reply-To: References: Date: Sat, 11 Apr 2015 23:45:55 -0700 X-Google-Sender-Auth: ekqys6EhShTJJGi-tru3huDPINE Message-ID: Subject: Re: using libgpio to bitbang LCDs! From: Adrian Chadd To: "freebsd-embedded@freebsd.org" , "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 06:45:56 -0000 Hi, The library source code and a demo program is available here: https://github.com/erikarn/freebsd-liblcd It includes the wiring needed to hook the example OLED board up (http://www.adafruit.com/products/684) to a Carambola 2 evaluation board. Anything you can get 5v and 5 GPIO pins from will work. (Well, as long as there's also libgpio / gpio API support for your device..) -adrian From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 08:44:48 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CEA3BA13; Sun, 12 Apr 2015 08:44:48 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8741C131; Sun, 12 Apr 2015 08:44:48 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1YhDVO-0003fZ-Jj; Sun, 12 Apr 2015 11:44:38 +0300 Date: Sun, 12 Apr 2015 11:44:38 +0300 From: Slawa Olhovchenkov To: Adrian Chadd Subject: Re: using libgpio to bitbang LCDs! Message-ID: <20150412084438.GM1394@zxy.spb.ru> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: "freebsd-embedded@freebsd.org" , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 08:44:48 -0000 On Sat, Apr 11, 2015 at 05:11:47PM -0700, Adrian Chadd wrote: > Hi! > > I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial task: > > * convert C++ to C, which was done primarily to not rely on the arduino-isms; > * use libgpio to bitbang the SPI bus needed to write to the LCD. > > It worked third time. First was "oh it runs on 5v power and 3.3v > signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't > set the pins to be output pins yet." Third time worked - just slowly. > > However - using libgpio was just pleasant. Get a handle, set the pin > config, set the pins high/low. It was pretty damned wonderful. > > It turns out that to fill the screen with individual pixel writes > takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000 > syscalls a second. Ian's suggested something sensible - a bulk data > ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one > syscall, a big chunk of data with instructions and timings. May be best choise is write() or netmap-like interface? From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 14:45:42 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 153202B0; Sun, 12 Apr 2015 14:45:42 +0000 (UTC) Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [IPv6:2a00:1450:400c:c00::22c]) (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 AF13AA8D; Sun, 12 Apr 2015 14:45:41 +0000 (UTC) Received: by wgyo15 with SMTP id o15so57808806wgy.2; Sun, 12 Apr 2015 07:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8pmKJyeQFOOPvIrWj0XlC/fgNFJbqig+ThhkAv/E9DQ=; b=NoDCsNhIpQ+5T1RExsZk2wsqwMe7Dr5oDM9m4xryKvwgS8pAFrKTGMZJKF27NmZyvw 7ptDFEiGfVAdH3hOySxyq8USnS2lgCnKCV46XWZ/3vlZRiUAUCsi3Drf7G3Y0UBYuJ/0 1D/pNjzNcNVYc1UUlwja2P5QdFZlRbypR5zPlgsBOiInG5DB+kynfRymVlE1i3MVZM9R t9QxhwjhdrKNSzKMXrSTb9VQTE8Q491YYVw9xKZ8rki+A9XqUIIbtEhY47+54WILOaks I7jIMk2R2QH+q2eg89v8Ler13GZdxlDB5gAOOsFKXm9TzYOg0cCPPoO5TP3D9xTKmkHg Sp1Q== MIME-Version: 1.0 X-Received: by 10.180.73.198 with SMTP id n6mr11143159wiv.3.1428849940229; Sun, 12 Apr 2015 07:45:40 -0700 (PDT) Received: by 10.180.195.106 with HTTP; Sun, 12 Apr 2015 07:45:40 -0700 (PDT) In-Reply-To: <7527478.9HOi23WthO@akita> References: <7527478.9HOi23WthO@akita> Date: Sun, 12 Apr 2015 11:45:40 -0300 Message-ID: Subject: Re: using libgpio to bitbang LCDs! From: Luiz Otavio O Souza To: Rui Paulo Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-embedded@freebsd.org" , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 14:45:42 -0000 On 11 April 2015 at 22:00, Rui Paulo wrote: > On Saturday 11 April 2015 17:11:47 Adrian Chadd wrote: >> Hi! >> >> I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial >> task: >> >> * convert C++ to C, which was done primarily to not rely on the >> arduino-isms; * use libgpio to bitbang the SPI bus needed to write to the >> LCD. >> >> It worked third time. First was "oh it runs on 5v power and 3.3v >> signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't >> set the pins to be output pins yet." Third time worked - just slowly. >> >> However - using libgpio was just pleasant. Get a handle, set the pin >> config, set the pins high/low. It was pretty damned wonderful. >> >> It turns out that to fill the screen with individual pixel writes >> takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000 >> syscalls a second. Ian's suggested something sensible - a bulk data >> ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one >> syscall, a big chunk of data with instructions and timings. > > Since this is an LCD, you probably want a way to export the GPIO bank via mmap > with write-combining enabled. It's not really a safe operation as it could > hang the GPIO driver, but it could be useful. > >> The other interesting thing would be a kind of bulk pin set/get - ie, >> instead of doing rmw for one pin at a time, communicate down masks of >> pins to do together. > > I think that's sensible and could be done via a separate (new) ioctl. I've patches for this (bank read and writing), it is pretty simple and should not block other approaches (mmap, bulk transfers, ...). Luiz From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:16:40 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 02F4037E for ; Mon, 13 Apr 2015 08:16:40 +0000 (UTC) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id BF5C51ED for ; Mon, 13 Apr 2015 08:16:39 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.60.3]) by phk.freebsd.dk (Postfix) with ESMTP id 5A1EA3B8A2 for ; Mon, 13 Apr 2015 08:16:37 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.9/8.14.9) with ESMTP id t3D8GavG078760 for ; Mon, 13 Apr 2015 08:16:36 GMT (envelope-from phk@phk.freebsd.dk) To: arch@freebsd.org Subject: default file descriptor limit ? From: Poul-Henning Kamp MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <78758.1428912996.1@critter.freebsd.dk> Date: Mon, 13 Apr 2015 08:16:36 +0000 Message-ID: <78759.1428912996@critter.freebsd.dk> X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:16:40 -0000 $ limits Resource limits (current): [...] openfiles 462357 say what ? This wastes tons of pointless close system calls in programs which use the suboptimal but best practice: for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) close(i); For reference Linux seems to default to 1024, leaving it up to massive server processes to increase the limit for themselves. I'm all for autosizing things but this is just plain stupid... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:22:01 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D98DF58B for ; Mon, 13 Apr 2015 08:22:01 +0000 (UTC) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5AE2FA for ; Mon, 13 Apr 2015 08:22:01 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.60.3]) by phk.freebsd.dk (Postfix) with ESMTP id A27DF3B8A2 for ; Mon, 13 Apr 2015 08:22:00 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.9/8.14.9) with ESMTP id t3D8M0Re079210 for ; Mon, 13 Apr 2015 08:22:00 GMT (envelope-from phk@phk.freebsd.dk) Subject: Re: default file descriptor limit ? In-reply-to: <78759.1428912996@critter.freebsd.dk> From: "Poul-Henning Kamp" References: <78759.1428912996@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <79208.1428913320.1@critter.freebsd.dk> Date: Mon, 13 Apr 2015 08:22:00 +0000 Message-ID: <79209.1428913320@critter.freebsd.dk> Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:22:01 -0000 -------- In message <78759.1428912996@critter.freebsd.dk>, Poul-Henning Kamp writes: > $ limits > Resource limits (current): > [...] > openfiles 462357 > >say what ? > >This wastes tons of pointless close system calls in programs which >use the suboptimal but best practice: > > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) > close(i); > >For reference Linux seems to default to 1024, leaving it up to >massive server processes to increase the limit for themselves. > >I'm all for autosizing things but this is just plain stupid... Just to give an idea how utterly silly this is: #include #include int main(int c, char **v) { int i, j; for (j = 0; j < 100; j++) for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) close(i); return (0); } Linux: 0.001 seconds FreeBSD: 17.020 seconds PS: And don't tell me to fix all code in /usr/ports to use closefrom(2). -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:32:03 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A0717AF for ; Mon, 13 Apr 2015 08:32:03 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6A7C5E9 for ; Mon, 13 Apr 2015 08:32:02 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1YhZmh-000ISz-NK; Mon, 13 Apr 2015 11:31:59 +0300 Date: Mon, 13 Apr 2015 11:31:59 +0300 From: Slawa Olhovchenkov To: Poul-Henning Kamp Subject: Re: default file descriptor limit ? Message-ID: <20150413083159.GN1394@zxy.spb.ru> References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <79209.1428913320@critter.freebsd.dk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:32:03 -0000 On Mon, Apr 13, 2015 at 08:22:00AM +0000, Poul-Henning Kamp wrote: > -------- > In message <78759.1428912996@critter.freebsd.dk>, Poul-Henning Kamp writes: > > $ limits > > Resource limits (current): > > [...] > > openfiles 462357 > > > >say what ? > > > >This wastes tons of pointless close system calls in programs which > >use the suboptimal but best practice: > > > > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) > > close(i); > > > >For reference Linux seems to default to 1024, leaving it up to > >massive server processes to increase the limit for themselves. This is typical only on startup, I think? > >I'm all for autosizing things but this is just plain stupid... > > Just to give an idea how utterly silly this is: > > #include > #include > > int > main(int c, char **v) > { > int i, j; > > for (j = 0; j < 100; j++) > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) > close(i); > return (0); > } > > Linux: 0.001 seconds > FreeBSD: 17.020 seconds > > > PS: And don't tell me to fix all code in /usr/ports to use closefrom(2). % time ./a.out 0.581u 3.302s 0:03.88 100.0% 5+168k 0+0io 0pf+0w % time limits -n 100 ./a.out 0.000u 0.004s 0:00.00 0.0% 0+0k 0+0io 0pf+0w % limits [...] openfiles 116460 May be now time to introduce new login class, for desktop users, with reduced limits for open files and some regionals settings. And modify bsdinstall to support this. And may be some Gnome/KDE tools for creating users (I am don't use KDE/Gnome). Base login class ('default') don't touching, don't have limits and have locale "C", used for system startup and daemons. From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:39:42 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 52042AA7 for ; Mon, 13 Apr 2015 08:39:42 +0000 (UTC) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 1419E63E for ; Mon, 13 Apr 2015 08:39:42 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.60.3]) by phk.freebsd.dk (Postfix) with ESMTP id 453DF3B8A2; Mon, 13 Apr 2015 08:39:41 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.9/8.14.9) with ESMTP id t3D8ddlV097930; Mon, 13 Apr 2015 08:39:40 GMT (envelope-from phk@phk.freebsd.dk) To: Slawa Olhovchenkov Subject: Re: default file descriptor limit ? In-reply-to: <20150413083159.GN1394@zxy.spb.ru> From: "Poul-Henning Kamp" References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> <20150413083159.GN1394@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <97928.1428914379.1@critter.freebsd.dk> Date: Mon, 13 Apr 2015 08:39:39 +0000 Message-ID: <97929.1428914379@critter.freebsd.dk> Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:39:42 -0000 -------- In message <20150413083159.GN1394@zxy.spb.ru>, Slawa Olhovchenkov writes: >> >This wastes tons of pointless close system calls in programs which >> >use the suboptimal but best practice: >> > >> > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) >> > close(i); >> > >> >For reference Linux seems to default to 1024, leaving it up to >> >massive server processes to increase the limit for themselves. > >This is typical only on startup, I think? No. This is mandatory whenever you spawn an sub process with less privilege. >May be now time to introduce new login class, for desktop users, [...] How about "now is the time to realize that very few processes need more than a few tens of filedescriptors" ? If Linux can manage with a hardcoded default of 1024, so can we... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:47:56 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14D08BC3 for ; Mon, 13 Apr 2015 08:47:56 +0000 (UTC) Received: from ipmail06.adl6.internode.on.net (ipmail06.adl6.internode.on.net [150.101.137.145]) by mx1.freebsd.org (Postfix) with ESMTP id 9693D76A for ; Mon, 13 Apr 2015 08:47:54 +0000 (UTC) X-IronPort-RLcust: INSIDEinternodeSR75 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CTCAA7gCtVPDdrLXlcgwyBLoZCrEwIBnuYLAKBMU0BAQEBAQEHAQEBATg7hB8BAQEDATocIwULCw4KFgEXOQoUBhOIIgfMAAEBAQEBBQEBAQEBAQEBARmGEIUbhCQlMwcSAYMEgRYFiy2FX4gCgg2HGI1UhCEuMYEDAQcXgSEBAQE Received: from ppp121-45-107-55.lns20.adl6.internode.on.net (HELO midget.dons.net.au) ([121.45.107.55]) by ipmail06.adl6.internode.on.net with ESMTP; 13 Apr 2015 18:12:43 +0930 Received: from [10.0.2.26] ([10.0.2.26]) (authenticated bits=0) by midget.dons.net.au (8.15.1/8.14.9) with ESMTPSA id t3D8gW2M016612 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 13 Apr 2015 18:12:40 +0930 (CST) (envelope-from darius@dons.net.au) Subject: Re: default file descriptor limit ? Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: text/plain; charset=us-ascii From: "O'Connor, Daniel" In-Reply-To: <20150413083159.GN1394@zxy.spb.ru> Date: Mon, 13 Apr 2015 18:12:31 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> <20150413083159.GN1394@zxy.spb.ru> To: Slawa Olhovchenkov X-Mailer: Apple Mail (2.2070.6) X-Spam-Score: -2.899 () ALL_TRUSTED,BAYES_00,URIBL_BLOCKED X-Scanned-By: MIMEDefang 2.75 on 10.0.2.1 Cc: arch@freebsd.org, Poul-Henning Kamp X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:47:56 -0000 > On 13 Apr 2015, at 18:01, Slawa Olhovchenkov wrote: > May be now time to introduce new login class, for desktop users, with > reduced limits for open files and some regionals settings. And modify > bsdinstall to support this. And may be some Gnome/KDE tools for > creating users (I am don't use KDE/Gnome). >=20 > Base login class ('default') don't touching, don't have limits and > have locale "C", used for system startup and daemons. The question is: What is the upside of having such a large limit? The downside is apparent - it's not the memory usage but the time wasted = when running secure software since you can't use closefrom because it's = not portable and so libraries/ports/etc don't use it (or more = realistically Linux doesn't have it). Other limits like max processes scaling with memory makes sense but = maxfiles should probably scale more slowly (or maybe even not at all..) -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:52:35 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3EA44CC3 for ; Mon, 13 Apr 2015 08:52:35 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8AAE839 for ; Mon, 13 Apr 2015 08:52:34 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Yha6V-000JPA-CE; Mon, 13 Apr 2015 11:52:27 +0300 Date: Mon, 13 Apr 2015 11:52:27 +0300 From: Slawa Olhovchenkov To: Poul-Henning Kamp Subject: Re: default file descriptor limit ? Message-ID: <20150413085227.GO1394@zxy.spb.ru> References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> <20150413083159.GN1394@zxy.spb.ru> <97929.1428914379@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97929.1428914379@critter.freebsd.dk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:52:35 -0000 On Mon, Apr 13, 2015 at 08:39:39AM +0000, Poul-Henning Kamp wrote: > -------- > In message <20150413083159.GN1394@zxy.spb.ru>, Slawa Olhovchenkov writes: > > >> >This wastes tons of pointless close system calls in programs which > >> >use the suboptimal but best practice: > >> > > >> > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) > >> > close(i); > >> > > >> >For reference Linux seems to default to 1024, leaving it up to > >> >massive server processes to increase the limit for themselves. > > > >This is typical only on startup, I think? > > No. This is mandatory whenever you spawn an sub process with less privilege. Hmm. 1. Whats [linux] application do this? 2. For case of reduce this limit -- how spawned application can increase this limit, if need? I am not sure, this is posible? > >May be now time to introduce new login class, for desktop users, [...] > > How about "now is the time to realize that very few processes need more > than a few tens of filedescriptors" ? > > If Linux can manage with a hardcoded default of 1024, so can we... And have many FAQs "how to overcome this restriction". Including "libc recompile" From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 08:55:30 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A2404DE7; Mon, 13 Apr 2015 08:55:30 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 83912855; Mon, 13 Apr 2015 08:55:30 +0000 (UTC) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id A54F4AD1; Mon, 13 Apr 2015 01:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1428915324; bh=tgIAltqN950QNexDVR+2k3al+WTaJ/e/PuSa3dTl6Mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VvRaGNg/ElC0Ekel0zQ0ngSqA7URS5aZBHrST0v4wBzU5D/iaiScq9uU7TGT3ZURG ZvOk61Ns0UQPHm05O8+jPjLK1xxhq4sJVhviOPO2IwV6F9r2t7hqdn1ps3YMMJgALW 1oP+FPyejH3fR2m/rt6a3I/1SV90tfYwV0ETzrc0= From: Peter Wemm To: freebsd-arch@freebsd.org Subject: Re: default file descriptor limit ? Date: Mon, 13 Apr 2015 01:55:19 -0700 Message-ID: <4628009.sor3oLh7vI@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <97929.1428914379@critter.freebsd.dk> References: <78759.1428912996@critter.freebsd.dk> <20150413083159.GN1394@zxy.spb.ru> <97929.1428914379@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1828611.bZ1r9AsyZ1"; micalg="pgp-sha256"; protocol="application/pgp-signature" Cc: arch@freebsd.org, Poul-Henning Kamp , Slawa Olhovchenkov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 08:55:30 -0000 --nextPart1828611.bZ1r9AsyZ1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Monday, April 13, 2015 08:39:39 AM Poul-Henning Kamp wrote: > If Linux can manage with a hardcoded default of 1024, so can we... For what its worth, a random redhat box: soft limit: 1024=20 hard limit: 16384=20 OSX: soft limit: 256 hard limit: unlimited 8-stable (ref8-amd64.freebsd.org): soft limit: 11095 hard limit: 11095 9-stable (and later, ref9-amd64.freebsd.org etc): soft limit: 707058 hard limit: 707058 This is fallout from the retarded maxusers changes a while ago. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart1828611.bZ1r9AsyZ1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJVK4R3AAoJEDXWlwnsgJ4EZlMH/2B5TRblm8L1CMNeeNzqJMNG 3gzVvnopQCrpPAVPv3cPCn+Y8N1zqUBvNUgYP6Uwj20jV6rsM5VRrD9tFdrrNN1X N5ZyA/lSGzmZe6G46FogpIYCoNC6ueOCAUfyTZLzjL6i4GXA4Kef1HncDUbpr4oN Y812XWomdCxy28+frCQ8yTk5nqhwVOdIJTmcdhEvijO/iUr4+5AHEqSLC4SncYMV wLZbjxyEHz0iDD7DjWGl3FOVhnpzZrWfjD5tLgYJjbdEUPd5FcsWe7JDn6tiRO+e MQNT8ZKnelyTCmabApn9zV7lpRu9YvweMLh56hTR8jBa0PgW36IXprezOGQ6cYM= =jMQG -----END PGP SIGNATURE----- --nextPart1828611.bZ1r9AsyZ1-- From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 09:47:11 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DD4FC67 for ; Mon, 13 Apr 2015 09:47:11 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 99540D6E for ; Mon, 13 Apr 2015 09:47:10 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id EA82A4201B1; Mon, 13 Apr 2015 19:47:00 +1000 (AEST) Date: Mon, 13 Apr 2015 19:46:59 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Poul-Henning Kamp Subject: Re: default file descriptor limit ? In-Reply-To: <79209.1428913320@critter.freebsd.dk> Message-ID: <20150413190438.X1619@besplex.bde.org> References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=ZuzUdbLG c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=EA5itrwUPoEA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=ZUNhNLIQv5YCmnLs6wMA:9 a=CjuIK1q_8ugA:10 Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 09:47:11 -0000 On Mon, 13 Apr 2015, Poul-Henning Kamp wrote: > -------- > In message <78759.1428912996@critter.freebsd.dk>, Poul-Henning Kamp writes: >> $ limits >> Resource limits (current): >> [...] >> openfiles 462357 >> >> say what ? >> >> This wastes tons of pointless close system calls in programs which >> use the suboptimal but best practice: >> >> for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) >> close(i); sysconf() takes about as long as a failing close(), so best practice is to cache the result of sysconf(). Best practice also requires error checking. >> For reference Linux seems to default to 1024, leaving it up to >> massive server processes to increase the limit for themselves. >> >> I'm all for autosizing things but this is just plain stupid... I would have used the POSIX/C limit of 20 for the default, leaving it up to mere bloatware to increase the limit. It is too late for that. Next best is a default of RLIM_INFINITY. In FreeBSD-1, RLIM_INFINITY was only 32 bits, so was only 5 times larger than the above. Now it is 64 bits, so it is 20 billion times larger. Getting the full limit also requires a 64-bit system, since sysconf() only returns long. sysconf(_SC_OPEN_MAX) doesn't even work on 32-bit systems if the limit is above LONG_MAX. > Just to give an idea how utterly silly this is: > > #include > #include > > int > main(int c, char **v) > { > int i, j; > > for (j = 0; j < 100; j++) > for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) > close(i); > return (0); > } > > Linux: 0.001 seconds > FreeBSD: 17.020 seconds 1 millisecond is a lot too. For full silliness: - optimize as above so that this takes half as long - increase the defaullt so that it takes 20 billion times longer. 17.020 / 2 * 20 billion seconds = 5393+ years. > PS: And don't tell me to fix all code in /usr/ports to use closefrom(2). I don't see any way to fix ports. I few might break with the limit of 1024. The only good thing is that the Linux limit is not very large and any ports that need a larger limit have probably been made to work under Linux. Worse but correct practice is the use the static limit of OPEN_MAX iff it is defined. Only broken systems like FreeBSD define it if the static limit is different from the dynamic limit. In FreeBSD, it is 64, so naive software that trusts the limit gets much faster loops than the above without really trying. libc sysconf() has poor handling of unrepresentable rlimits in all cases (just 2 cases; the other one is _SC_CHILD_MAX. The static limit CHILD_MAX is broken by its existence in FreeBSD in the same way as OPEN_MAX): X case _SC_OPEN_MAX: X if (getrlimit(RLIMIT_NOFILE, &rl) != 0) X return (-1); X if (rl.rlim_cur == RLIM_INFINITY) X return (-1); This is not an error, just an unrepresentable limit. This fails to set errno to indicate the error (getrlimit() didn't since this is not an error). This works in practice because it is unreachable -- the kernel clamps this particular rlimit, so RLIM_INFINITY is impossible. X if (rl.rlim_cur > LONG_MAX) { X errno = EOVERFLOW; X return (-1); X } As above, except it sets errno. If this were reachable, then it would cause problems for buggy applications that don't check for errors. But this case shouldn't be an error. LONG_MAX file descriptors should be enough for anybloatware. When 32-bit LONG_MAX runs out, the bloatware can simply require a 64-bit system. X return ((long)rl.rlim_cur); Bruce From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 10:15:37 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 57107236 for ; Mon, 13 Apr 2015 10:15:37 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 17DAD1000 for ; Mon, 13 Apr 2015 10:15:36 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 92B4A4273C0; Mon, 13 Apr 2015 20:15:31 +1000 (AEST) Date: Mon, 13 Apr 2015 20:15:30 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Poul-Henning Kamp Subject: Re: default file descriptor limit ? In-Reply-To: <97929.1428914379@critter.freebsd.dk> Message-ID: <20150413194709.L1619@besplex.bde.org> References: <78759.1428912996@critter.freebsd.dk> <79209.1428913320@critter.freebsd.dk> <20150413083159.GN1394@zxy.spb.ru> <97929.1428914379@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=ZuzUdbLG c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=EA5itrwUPoEA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=KawIFhhbAAAA:8 a=odNzpWaeI0nUqWQo6FwA:9 a=CjuIK1q_8ugA:10 Cc: arch@freebsd.org, Slawa Olhovchenkov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 10:15:37 -0000 On Mon, 13 Apr 2015, Poul-Henning Kamp wrote: > -------- > In message <20150413083159.GN1394@zxy.spb.ru>, Slawa Olhovchenkov writes: > >>>> This wastes tons of pointless close system calls in programs which >>>> use the suboptimal but best practice: >>>> >>>> for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) >>>> close(i); >>>> >>>> For reference Linux seems to default to 1024, leaving it up to >>>> massive server processes to increase the limit for themselves. >> >> This is typical only on startup, I think? > > No. This is mandatory whenever you spawn an sub process with less privilege. Not quite. sysconf() returns the soft rlimit. Privilege is not need to change the soft rlimit back and forth between 0 and the hard rlimit. >> May be now time to introduce new login class, for desktop users, [...] > > How about "now is the time to realize that very few processes need more > than a few tens of filedescriptors" ? > > If Linux can manage with a hardcoded default of 1024, so can we... RLIM_INFINITY seems reasonable for the hard limit and 1024 for the soft limit. Large auto-configed values like 400000 are insignificantly different from infinity anyway. They are per-process, so even the limits of 11000 on my small systems are also essentially infinite. There are also the kern.maxfilesperproc and kern.maxfiles limits. These are poorly implemented, starting with their default values. maxfilesperproc defaults to the same value as the rlimit. So a single process that allocates up to its rlimit makes it impossible for any other process, even privileged ones, to get anywhere near their rlimit. Some over-commit is needed, but not this much. This has hacks to let privileged processes allocate a few more descriptors provided priv. processes never over-commit. Bruce From owner-freebsd-arch@FreeBSD.ORG Mon Apr 13 16:11:48 2015 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A28C44AB; Mon, 13 Apr 2015 16:11:48 +0000 (UTC) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) by mx1.freebsd.org (Postfix) with ESMTP id 7E0B9FCD; Mon, 13 Apr 2015 16:11:48 +0000 (UTC) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id CB0855A9F27; Mon, 13 Apr 2015 16:11:41 +0000 (UTC) Date: Mon, 13 Apr 2015 16:11:41 +0000 From: Brooks Davis To: Baptiste Daroussin Subject: Re: RFC: Alternative to PRIVATELIB Message-ID: <20150413161141.GA61857@spindle.one-eyed-alien.net> References: <20150411142835.GE65320@ivaldir.etoilebsd.net> <20150411151412.GF65320@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <20150411151412.GF65320@ivaldir.etoilebsd.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 16:11:48 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 11, 2015 at 05:14:12PM +0200, Baptiste Daroussin wrote: > On Sat, Apr 11, 2015 at 04:28:35PM +0200, Baptiste Daroussin wrote: > > Hi, > >=20 > > I would like to propose to replace PRIVATELIB with something more conve= nient. > >=20 > > First what is PRIVATELIB is trying to solve: > > We are maintaining stable ABI over branches but some third parties sour= ces > > are not really good at maintaining stable ABI, so we do hide them into = private > > where nothing can use it. We do not provide headers for that and we add= rpath to > > every binaries that needs to link to those. > >=20 > > What is the issues of PRIVATELIB: > > any application linking to a library from base (a regular one) that doe= s itself > > links to a PRIVATELIB cannot anymore statically link to the said applic= ation. > >=20 > > The is no mechanism to handle PRIVATELIBS in compat*x ports which can b= e a > > problem if one of our regular lib is linked to a privatelib and ends up= into > > compat one day. > >=20 > > It prevents easy linking for 3rd party application using those privatel= ibs on > > purpose (aka with the knowledge abi can break) like libbsdstat. > >=20 > > What I would like to propose is the following: > >=20 > > Create in bsd.lib.mk support for PRIVATE knobs (what ever name you do p= refer) > >=20 > > It will just prefix the name of the library with "private" but install = it in the > > regular place > >=20 > > It will automatically decide to install the headers into /usr/include/p= rivate/${LIB}/ > > Each private library headers in a custom place to avoid an application = that > > deliberatly use a given privatelib to find another one > >=20 > > Prefix all manpage with private_ so that we can provide the documentati= on for > > the said libs for the version we ship but if another version is shipped= by ports > > then we can easily access both documentation. > >=20 > > As a result bsd.lib.mk will be simpler, we could again static link agai= nst > > everything we ship in base, we can provide documentation for those libs= and we > > can easily isolate them anyway from the ports. > >=20 > > I plan to start working on this in a week. >=20 > This patch shows an example with libucl: > https://people.freebsd.org/~bapt/private.diff This seems good to me. -- Brooks --/04w6evG8XlLl3ft Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlUr6rsACgkQXY6L6fI4GtShFgCdE+OA9dsweQwoy2PpVbl4i1Pl pjEAoIpvxyAywZsl5f5+dRMWEt29YJYK =hZcd -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 07:59:40 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DEB9D8A for ; Fri, 17 Apr 2015 07:59:40 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C388D393 for ; Fri, 17 Apr 2015 07:59:39 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3H7xXWL065484 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Fri, 17 Apr 2015 10:59:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3H7xXWL065484 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3H7xXT0065483 for arch@freebsd.org; Fri, 17 Apr 2015 10:59:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2015 10:59:33 +0300 From: Konstantin Belousov To: arch@freebsd.org Subject: Make ppoll(2) and waitid(2) cancellation points Message-ID: <20150417075933.GH2390@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 07:59:40 -0000 Patch below makes ppoll(2) and waitid(2) cancellable. The waitid(2) is required to be a cancellation point by POSIX, so the change fixes a definite bug. It is done by making wait6() cancellable, in line with the other wait*(2) syscalls. For ppoll(2), our other select/poll interfaces are cancel points, i.e. select, pselect, and poll. It is reasonable for ppoll() to follow the suite. The interposing table was extended at the end, instead of ordering new interposers by alphabet. It would be acceptable, but makes it easier for people to run new libc with older libthr (although not supported). diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index ceaa2a3..2de6f77 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -222,6 +222,8 @@ enum { INTERPOS_spinlock, INTERPOS_spinunlock, INTERPOS_kevent, + INTERPOS_wait6, + INTERPOS_ppoll, INTERPOS_MAX }; @@ -305,6 +307,8 @@ struct timeval; struct timezone; struct __siginfo; struct __ucontext; +struct __wrusage; +enum idtype; int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *); int __sys_accept(int, struct sockaddr *, __socklen_t *); @@ -329,6 +333,8 @@ int __sys_pselect(int, struct fd_set *, struct fd_set *, struct fd_set *, const struct timespec *, const __sigset_t *); int __sys_poll(struct pollfd *, unsigned, int); +int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *, + const __sigset_t *); __ssize_t __sys_pread(int, void *, __size_t, __off_t); __ssize_t __sys_pwrite(int, const void *, __size_t, __off_t); __ssize_t __sys_read(int, void *, __size_t); @@ -357,6 +363,8 @@ int __sys_thr_kill(long, int); int __sys_thr_self(long *); int __sys_truncate(const char *, __off_t); __pid_t __sys_wait4(__pid_t, int *, int, struct rusage *); +__pid_t __sys_wait6(enum idtype, __id_t, int *, int, + struct __wrusage *, struct __siginfo *); __ssize_t __sys_write(int, const void *, __size_t); __ssize_t __sys_writev(int, const struct iovec *, int); diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 7745b2a..a38a923 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -57,6 +57,7 @@ INTERPOSED = \ open \ openat \ poll \ + ppoll \ pselect \ read \ readv \ @@ -73,6 +74,7 @@ INTERPOSED = \ sigwaitinfo \ swapcontext \ wait4 \ + wait6 \ write \ writev diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c index 4290bc6..c4d1429 100644 --- a/lib/libc/sys/interposing_table.c +++ b/lib/libc/sys/interposing_table.c @@ -76,6 +76,8 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = { SLOT(spinlock, __libc_spinlock_stub), SLOT(spinunlock, __libc_spinunlock_stub), SLOT(kevent, __sys_kevent), + SLOT(wait6, __sys_wait6), + SLOT(ppoll, __sys_ppoll), }; #undef SLOT diff --git a/lib/libc/sys/ppoll.c b/lib/libc/sys/ppoll.c new file mode 100644 index 0000000..f62fd19 --- /dev/null +++ b/lib/libc/sys/ppoll.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2015 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +__weak_reference(__sys_ppoll, __ppoll); + +#pragma weak ppoll +int +ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict + timeout, const sigset_t *__restrict newsigmask) +{ + + return (((int (*)(struct pollfd *, nfds_t, const struct timespec *, + const sigset_t *)) __libc_interposing[INTERPOS_ppoll])(pfd, nfds, + timeout, newsigmask)); +} diff --git a/lib/libc/sys/wait6.c b/lib/libc/sys/wait6.c new file mode 100644 index 0000000..f0e2999 --- /dev/null +++ b/lib/libc/sys/wait6.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "libc_private.h" + +__weak_reference(__sys_wait6, __wait6); + +#pragma weak wait6 +pid_t +wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *ru, + siginfo_t *infop) +{ + + return (((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *, + siginfo_t *))__libc_interposing[INTERPOS_wait6])(idtype, id, + status, options, ru, infop)); +} diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index e71bf4a..2869358 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -321,6 +321,21 @@ __thr_poll(struct pollfd *fds, unsigned int nfds, int timeout) return (ret); } +static int +__thr_ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec * + timeout, const sigset_t *newsigmask) +{ + struct pthread *curthread; + int ret; + + curthread = _get_curthread(); + _thr_cancel_enter(curthread); + ret = __sys_ppoll(pfd, nfds, timeout, newsigmask); + _thr_cancel_leave(curthread, ret == -1); + + return (ret); +} + /* * Cancellation behavior: * Thread may be canceled at start, but if the system call returns something, @@ -543,6 +558,20 @@ __thr_wait4(pid_t pid, int *status, int options, struct rusage *rusage) return (ret); } +static pid_t +__thr_wait6(idtype_t idtype, id_t id, int *status, int options, + struct __wrusage *ru, siginfo_t *infop) +{ + struct pthread *curthread; + pid_t ret; + + curthread = _get_curthread(); + _thr_cancel_enter(curthread); + ret = __sys_wait6(idtype, id, status, options, ru, infop); + _thr_cancel_leave(curthread, ret <= 0); + return (ret); +} + /* * Cancellation behavior: * Thread may be canceled at start, but if the thread wrote some data, @@ -623,6 +652,8 @@ __thr_interpose_libc(void) SLOT(spinlock); SLOT(spinunlock); SLOT(kevent); + SLOT(wait6); + SLOT(ppoll); #undef SLOT *(__libc_interposing_slot( INTERPOS__pthread_mutex_init_calloc_cb)) = diff --git a/share/man/man3/pthread_testcancel.3 b/share/man/man3/pthread_testcancel.3 index 0b54290..fc412de 100644 --- a/share/man/man3/pthread_testcancel.3 +++ b/share/man/man3/pthread_testcancel.3 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd March 29, 2015 +.Dd April 16, 2015 .Dt PTHREAD_TESTCANCEL 3 .Os .Sh NAME @@ -132,6 +132,7 @@ argument is non-zero. .It Fn openat .It Fn pause .It Fn poll +.It Fn ppoll .It Fn pselect .It Fn pthread_cond_timedwait .It Fn pthread_cond_wait @@ -159,6 +160,8 @@ argument is non-zero. .It Fn wait .It Fn wait3 .It Fn wait4 +.It Fn wait6 +.It Fn waitid .It Fn waitpid .It Fn write .It Fn writev From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 07:59:51 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DA81E2F; Fri, 17 Apr 2015 07:59:51 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 773173A0; Fri, 17 Apr 2015 07:59:50 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3H7xgmC065501 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 17 Apr 2015 10:59:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3H7xgmC065501 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3H7xgwK065500; Fri, 17 Apr 2015 10:59:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2015 10:59:42 +0300 From: Konstantin Belousov To: arch@freebsd.org Cc: peter@freebsd.org Subject: Removal of the 6.x kernel compat code from libc Message-ID: <20150417075942.GI2390@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 07:59:51 -0000 Our libc changes in sync with the kernel, but switching of libc to use new interfaces means that upgrade of the userspace becomes the flag day. People usually add backward-compatible shims for libc to use older interfaces on old kernels. There is no reason to keep the compat shims after many years of the transition. Patch below purges the compat code for pre-r171219, which added pad-less versions of syscalls taking off_t, and for r177911, which handles the struct flock/oflock transition. This is 6.x/7.x compat, we absolutely not support running HEAD libc on such old kernels. diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 8e0d614..46ea955 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc index f36ab71..60c2dc3 100644 --- a/lib/libc/arm/sys/Makefile.inc +++ b/lib/libc/arm/sys/Makefile.inc @@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _exit.o _getlogin.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc index b56183c..ebaa462 100644 --- a/lib/libc/i386/sys/Makefile.inc +++ b/lib/libc/i386/sys/Makefile.inc @@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h index 2b8f0de..6ab17d7 100644 --- a/lib/libc/include/compat.h +++ b/lib/libc/include/compat.h @@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); #define __weak_reference(sym,alias) \ .weak alias;.equ alias,sym -#ifndef SYSCALL_COMPAT __weak_reference(__sys_fcntl,__fcntl_compat) -#endif #undef __weak_reference diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index ceaa2a3..53be867 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -276,21 +276,12 @@ extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly - * ignores value of $OSVERSION and caches result. Prototypes - * for the wrapped "new" pad-less syscalls are here for now. + * ignores value of $OSVERSION and caches result. */ int __getosreldate(void); #include #include -/* With pad */ -__off_t __sys_freebsd6_lseek(int, int, __off_t, int); -int __sys_freebsd6_ftruncate(int, int, __off_t); -int __sys_freebsd6_truncate(const char *, int, __off_t); -__ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); -__ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); -void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); - struct aiocb; struct fd_set; struct iovec; diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc index ad98ba1..98ec888 100644 --- a/lib/libc/powerpc/sys/Makefile.inc +++ b/lib/libc/powerpc/sys/Makefile.inc @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc index ad98ba1..98ec888 100644 --- a/lib/libc/powerpc64/sys/Makefile.inc +++ b/lib/libc/powerpc64/sys/Makefile.inc @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc index 726c0c9..a62aac2 100644 --- a/lib/libc/sparc64/sys/Makefile.inc +++ b/lib/libc/sparc64/sys/Makefile.inc @@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 7745b2a..b63aa89 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -26,18 +26,6 @@ SRCS+= \ __error.c \ interposing_table.c -.if ${MK_SYSCALL_COMPAT} != "no" -SYSCALL_COMPAT_SRCS= \ - ftruncate.c \ - lseek.c \ - mmap.c \ - pread.c \ - pwrite.c \ - truncate.c -SRCS+= ${SYSCALL_COMPAT_SRCS} -NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/} -.endif - SRCS+= futimens.c utimensat.c NOASM+= futimens.o utimensat.o PSEUDO+= _futimens.o _utimensat.o diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c index 7af617e..dfc722a 100644 --- a/lib/libc/sys/fcntl.c +++ b/lib/libc/sys/fcntl.c @@ -3,6 +3,12 @@ * Authors: Doug Rabson * Developed with Red Inc: Alfred Perlstein * + * Copyright (c) 2014, 2015 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -48,59 +54,3 @@ fcntl(int fd, int cmd, ...) return (((int (*)(int, int, ...)) __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); } - -#ifdef SYSCALL_COMPAT -__weak_reference(__fcntl_compat, __fcntl); - -int -__fcntl_compat(int fd, int cmd, ...) -{ - va_list args; - long arg; - struct __oflock ofl; - struct flock *flp; - int res; - - va_start(args, cmd); - arg = va_arg(args, long); - va_end(args); - - if (__getosreldate() >= 800028) { - return (__sys_fcntl(fd, cmd, arg)); - } else { - if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) { - /* - * Convert new-style struct flock (which - * includes l_sysid) to old-style. - */ - flp = (struct flock *) (uintptr_t) arg; - ofl.l_start = flp->l_start; - ofl.l_len = flp->l_len; - ofl.l_pid = flp->l_pid; - ofl.l_type = flp->l_type; - ofl.l_whence = flp->l_whence; - - switch (cmd) { - case F_GETLK: - res = __sys_fcntl(fd, F_OGETLK, &ofl); - if (res >= 0) { - flp->l_start = ofl.l_start; - flp->l_len = ofl.l_len; - flp->l_pid = ofl.l_pid; - flp->l_type = ofl.l_type; - flp->l_whence = ofl.l_whence; - flp->l_sysid = 0; - } - return (res); - - case F_SETLK: - return (__sys_fcntl(fd, F_OSETLK, &ofl)); - - case F_SETLKW: - return (__sys_fcntl(fd, F_OSETLKW, &ofl)); - } - } - return (__sys_fcntl(fd, cmd, arg)); - } -} -#endif diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c deleted file mode 100644 index 78b5a36..0000000 --- a/lib/libc/sys/ftruncate.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -ftruncate(fd, length) - int fd; - off_t length; -{ - - if (__getosreldate() >= 700051) - return(__sys_ftruncate(fd, length)); - else - return(__sys_freebsd6_ftruncate(fd, 0, length)); -} diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c index 4290bc6..0ffc426 100644 --- a/lib/libc/sys/interposing_table.c +++ b/lib/libc/sys/interposing_table.c @@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = { SLOT(aio_suspend, __sys_aio_suspend), SLOT(close, __sys_close), SLOT(connect, __sys_connect), - SLOT(fcntl, __fcntl_compat), + SLOT(fcntl, __sys_fcntl), SLOT(fsync, __sys_fsync), SLOT(fork, __sys_fork), SLOT(msync, __sys_msync), diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c deleted file mode 100644 index a086be1..0000000 --- a/lib/libc/sys/lseek.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -off_t -lseek(fd, offset, whence) - int fd; - off_t offset; - int whence; -{ - - if (__getosreldate() >= 700051) - return(__sys_lseek(fd, offset, whence)); - else - return(__sys_freebsd6_lseek(fd, 0, offset, whence)); -} diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c deleted file mode 100644 index 0fa03ba..0000000 --- a/lib/libc/sys/mmap.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -void * -mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) -{ - - if (__getosreldate() >= 700051) { - return (__sys_mmap(addr, len, prot, flags, fd, offset)); - } else { - return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, - offset)); - } -} diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c deleted file mode 100644 index 7566566..0000000 --- a/lib/libc/sys/pread.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pread(fd, buf, nbyte, offset) - int fd; - void *buf; - size_t nbyte; - off_t offset; -{ - - if (__getosreldate() >= 700051) - return (__sys_pread(fd, buf, nbyte, offset)); - else - return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset)); -} diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c deleted file mode 100644 index d17ed29..0000000 --- a/lib/libc/sys/pwrite.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pwrite(fd, buf, nbyte, offset) - int fd; - const void *buf; - size_t nbyte; - off_t offset; -{ - if (__getosreldate() >= 700051) - return (__sys_pwrite(fd, buf, nbyte, offset)); - else - return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset)); -} diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c deleted file mode 100644 index 375c9d9..0000000 --- a/lib/libc/sys/truncate.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -truncate(path, length) - const char *path; - off_t length; -{ - - if (__getosreldate() >= 700051) - return(__sys_truncate(path, length)); - else - return(__sys_freebsd6_truncate(path, 0, length)); -} diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index e71bf4a..a3c6151 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -95,10 +95,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "thr_private.h" -#ifdef SYSCALL_COMPAT -extern int __fcntl_compat(int, int, ...); -#endif - static int __thr_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { @@ -203,18 +199,10 @@ __thr_fcntl(int fd, int cmd, ...) va_start(ap, cmd); if (cmd == F_OSETLKW || cmd == F_SETLKW) { _thr_cancel_enter(curthread); -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif _thr_cancel_leave(curthread, ret == -1); } else { -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif } va_end(ap); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 8fc1db9..213801a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -219,6 +219,7 @@ sys_pread(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pread(td, uap) struct thread *td; @@ -232,6 +233,7 @@ freebsd6_pread(td, uap) oargs.offset = uap->offset; return (sys_pread(td, &oargs)); } +#endif /* * Scatter read system call. @@ -430,6 +432,7 @@ sys_pwrite(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pwrite(td, uap) struct thread *td; @@ -443,6 +446,7 @@ freebsd6_pwrite(td, uap) oargs.offset = uap->offset; return (sys_pwrite(td, &oargs)); } +#endif /* * Gather write system call. diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 09d38d4..9873868 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -342,9 +342,9 @@ int a4); } ; XXX should be { int shmsys(int which, ...); } 172 AUE_NULL UNIMPL nosys -173 AUE_PREAD STD { ssize_t freebsd6_pread(int fd, void *buf, \ +173 AUE_PREAD COMPAT6 { ssize_t pread(int fd, void *buf, \ size_t nbyte, int pad, off_t offset); } -174 AUE_PWRITE STD { ssize_t freebsd6_pwrite(int fd, \ +174 AUE_PWRITE COMPAT6 { ssize_t pwrite(int fd, \ const void *buf, \ size_t nbyte, int pad, off_t offset); } 175 AUE_NULL STD { int setfib(int fibnum); } @@ -376,16 +376,16 @@ __setrlimit_args int 196 AUE_GETDIRENTRIES STD { int getdirentries(int fd, char *buf, \ u_int count, long *basep); } -197 AUE_MMAP STD { caddr_t freebsd6_mmap(caddr_t addr, \ +197 AUE_MMAP COMPAT6 { caddr_t mmap(caddr_t addr, \ size_t len, int prot, int flags, int fd, \ int pad, off_t pos); } 198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ __syscall_args int -199 AUE_LSEEK STD { off_t freebsd6_lseek(int fd, int pad, \ +199 AUE_LSEEK COMPAT6 { off_t lseek(int fd, int pad, \ off_t offset, int whence); } -200 AUE_TRUNCATE STD { int freebsd6_truncate(char *path, int pad, \ +200 AUE_TRUNCATE COMPAT6 { int truncate(char *path, int pad, \ off_t length); } -201 AUE_FTRUNCATE STD { int freebsd6_ftruncate(int fd, int pad, \ +201 AUE_FTRUNCATE COMPAT6 { int ftruncate(int fd, int pad, \ off_t length); } 202 AUE_SYSCTL STD { int __sysctl(int *name, u_int namelen, \ void *old, size_t *oldlenp, void *new, \ diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8c8ca31..c5c479d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1933,6 +1933,7 @@ olseek(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Version with the 'pad' argument */ int freebsd6_lseek(td, uap) @@ -1946,6 +1947,7 @@ freebsd6_lseek(td, uap) ouap.whence = uap->whence; return (sys_lseek(td, &ouap)); } +#endif /* * Check access permissions using passed credentials. @@ -3423,6 +3425,7 @@ otruncate(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Versions with the pad argument */ int freebsd6_truncate(struct thread *td, struct freebsd6_truncate_args *uap) @@ -3443,6 +3446,7 @@ freebsd6_ftruncate(struct thread *td, struct freebsd6_ftruncate_args *uap) ouap.length = uap->length; return (sys_ftruncate(td, &ouap)); } +#endif /* * Sync an open file. diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index a9ff248..02634d6 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -462,6 +462,7 @@ done: return (error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) { @@ -475,6 +476,7 @@ freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) oargs.pos = uap->pos; return (sys_mmap(td, &oargs)); } +#endif #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_ From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 11:39:11 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F628250 for ; Fri, 17 Apr 2015 11:39:11 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) (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 1DD6D188 for ; Fri, 17 Apr 2015 11:39:10 +0000 (UTC) Received: by oica37 with SMTP id a37so70561692oic.0 for ; Fri, 17 Apr 2015 04:39:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=iMMBDaIXf1+WaQuW1J3TSHJ5Ko8iYWx12igTf+lVZE8=; b=lm/kwg4AKi8kcGgIVU7wkHruxf0ZsO5Ozzj+fY5rog2tGJ3y3GW7q+iYRHfWp+iHx5 vxxK/8+rOTu0UpstM5TK4OMynXSFugIOZp3u3sPCQgLCuQZ3XT1mvHWSQsg6mp5M793e QQw1SWgEu5B5supAaubH67RYtLko4uwmSBjRvQSOCDUrZsZ92L9EJOryQythI8rLjIpC u10bAU76YRH5H42eMvrCFM/j8kOC8v7lDwF8o6E4O1oWhIRXPULmD5fC2KrYLqcBltYs o0Jy5p4tD5KXGUlKX/khWEtzGfEAgeiKL/RbB+yT/D8x81mFAZi1OpQ7D99TRArr6TLC F2fA== X-Gm-Message-State: ALoCoQl4NNVh7WUSUtzjW4ZuKPie4es4ygB60jQxZrSmPudFwHKF1Fp2YGWaWJnZ/PpHBV+vvQK9 MIME-Version: 1.0 X-Received: by 10.202.84.135 with SMTP id i129mr2389649oib.114.1429270744456; Fri, 17 Apr 2015 04:39:04 -0700 (PDT) Received: by 10.202.80.6 with HTTP; Fri, 17 Apr 2015 04:39:04 -0700 (PDT) In-Reply-To: <20150417075942.GI2390@kib.kiev.ua> References: <20150417075942.GI2390@kib.kiev.ua> Date: Fri, 17 Apr 2015 13:39:04 +0200 Message-ID: Subject: Re: Removal of the 6.x kernel compat code from libc From: Oliver Pinter To: Konstantin Belousov Cc: "freebsd-arch@freebsd.org" , peter@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 11:39:11 -0000 On Fri, Apr 17, 2015 at 9:59 AM, Konstantin Belousov wrote: > Our libc changes in sync with the kernel, but switching of libc to use > new interfaces means that upgrade of the userspace becomes the flag day. > People usually add backward-compatible shims for libc to use older > interfaces on old kernels. > > There is no reason to keep the compat shims after many years of the > transition. Patch below purges the compat code for pre-r171219, which > added pad-less versions of syscalls taking off_t, and for r177911, which > handles the struct flock/oflock transition. This is 6.x/7.x compat, > we absolutely not support running HEAD libc on such old kernels. > > diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc > index 8e0d614..46ea955 100644 > --- a/lib/libc/amd64/sys/Makefile.inc > +++ b/lib/libc/amd64/sys/Makefile.inc > @@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o > > PSEUDO= _getlogin.o _exit.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc > index f36ab71..60c2dc3 100644 > --- a/lib/libc/arm/sys/Makefile.inc > +++ b/lib/libc/arm/sys/Makefile.inc > @@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o > > PSEUDO= _exit.o _getlogin.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc > index b56183c..ebaa462 100644 > --- a/lib/libc/i386/sys/Makefile.inc > +++ b/lib/libc/i386/sys/Makefile.inc > @@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o > > PSEUDO= _getlogin.o _exit.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > > MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 > MAN+= i386_set_watch.3 > diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h > index 2b8f0de..6ab17d7 100644 > --- a/lib/libc/include/compat.h > +++ b/lib/libc/include/compat.h > @@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); > #define __weak_reference(sym,alias) \ > .weak alias;.equ alias,sym > > -#ifndef SYSCALL_COMPAT > __weak_reference(__sys_fcntl,__fcntl_compat) > -#endif > > #undef __weak_reference > > diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h > index ceaa2a3..53be867 100644 > --- a/lib/libc/include/libc_private.h > +++ b/lib/libc/include/libc_private.h > @@ -276,21 +276,12 @@ extern void (*__cleanup)(void) __hidden; > > /* > * Get kern.osreldate to detect ABI revisions. Explicitly > - * ignores value of $OSVERSION and caches result. Prototypes > - * for the wrapped "new" pad-less syscalls are here for now. > + * ignores value of $OSVERSION and caches result. > */ > int __getosreldate(void); > #include > #include > > -/* With pad */ > -__off_t __sys_freebsd6_lseek(int, int, __off_t, int); > -int __sys_freebsd6_ftruncate(int, int, __off_t); > -int __sys_freebsd6_truncate(const char *, int, __off_t); > -__ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); > -__ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); > -void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); > - > struct aiocb; > struct fd_set; > struct iovec; > diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc > index ad98ba1..98ec888 100644 > --- a/lib/libc/powerpc/sys/Makefile.inc > +++ b/lib/libc/powerpc/sys/Makefile.inc > @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o > > PSEUDO= _getlogin.o _exit.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc > index ad98ba1..98ec888 100644 > --- a/lib/libc/powerpc64/sys/Makefile.inc > +++ b/lib/libc/powerpc64/sys/Makefile.inc > @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o > > PSEUDO= _getlogin.o _exit.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc > index 726c0c9..a62aac2 100644 > --- a/lib/libc/sparc64/sys/Makefile.inc > +++ b/lib/libc/sparc64/sys/Makefile.inc > @@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S > NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o > > PSEUDO= _getlogin.o _exit.o > -.if ${MK_SYSCALL_COMPAT} != "no" > -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o > -.endif > diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc > index 7745b2a..b63aa89 100644 > --- a/lib/libc/sys/Makefile.inc > +++ b/lib/libc/sys/Makefile.inc > @@ -26,18 +26,6 @@ SRCS+= \ > __error.c \ > interposing_table.c > > -.if ${MK_SYSCALL_COMPAT} != "no" > -SYSCALL_COMPAT_SRCS= \ > - ftruncate.c \ > - lseek.c \ > - mmap.c \ > - pread.c \ > - pwrite.c \ > - truncate.c > -SRCS+= ${SYSCALL_COMPAT_SRCS} > -NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/} > -.endif > - > SRCS+= futimens.c utimensat.c > NOASM+= futimens.o utimensat.o > PSEUDO+= _futimens.o _utimensat.o > diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c > index 7af617e..dfc722a 100644 > --- a/lib/libc/sys/fcntl.c > +++ b/lib/libc/sys/fcntl.c > @@ -3,6 +3,12 @@ > * Authors: Doug Rabson > * Developed with Red Inc: Alfred Perlstein > * > + * Copyright (c) 2014, 2015 The FreeBSD Foundation. > + * All rights reserved. > + * > + * Portions of this software were developed by Konstantin Belousov > + * under sponsorship from the FreeBSD Foundation. > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -48,59 +54,3 @@ fcntl(int fd, int cmd, ...) > return (((int (*)(int, int, ...)) > __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); > } > - > -#ifdef SYSCALL_COMPAT > -__weak_reference(__fcntl_compat, __fcntl); > - > -int > -__fcntl_compat(int fd, int cmd, ...) > -{ > - va_list args; > - long arg; > - struct __oflock ofl; > - struct flock *flp; > - int res; > - > - va_start(args, cmd); > - arg = va_arg(args, long); > - va_end(args); > - > - if (__getosreldate() >= 800028) { > - return (__sys_fcntl(fd, cmd, arg)); > - } else { > - if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) { > - /* > - * Convert new-style struct flock (which > - * includes l_sysid) to old-style. > - */ > - flp = (struct flock *) (uintptr_t) arg; > - ofl.l_start = flp->l_start; > - ofl.l_len = flp->l_len; > - ofl.l_pid = flp->l_pid; > - ofl.l_type = flp->l_type; > - ofl.l_whence = flp->l_whence; > - > - switch (cmd) { > - case F_GETLK: > - res = __sys_fcntl(fd, F_OGETLK, &ofl); > - if (res >= 0) { > - flp->l_start = ofl.l_start; > - flp->l_len = ofl.l_len; > - flp->l_pid = ofl.l_pid; > - flp->l_type = ofl.l_type; > - flp->l_whence = ofl.l_whence; > - flp->l_sysid = 0; > - } > - return (res); > - > - case F_SETLK: > - return (__sys_fcntl(fd, F_OSETLK, &ofl)); > - > - case F_SETLKW: > - return (__sys_fcntl(fd, F_OSETLKW, &ofl)); > - } > - } > - return (__sys_fcntl(fd, cmd, arg)); > - } > -} > -#endif > diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c > deleted file mode 100644 > index 78b5a36..0000000 > --- a/lib/libc/sys/ftruncate.c > +++ /dev/null > @@ -1,55 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -int > -ftruncate(fd, length) > - int fd; > - off_t length; > -{ > - > - if (__getosreldate() >= 700051) > - return(__sys_ftruncate(fd, length)); > - else > - return(__sys_freebsd6_ftruncate(fd, 0, length)); > -} > diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c > index 4290bc6..0ffc426 100644 > --- a/lib/libc/sys/interposing_table.c > +++ b/lib/libc/sys/interposing_table.c > @@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = { > SLOT(aio_suspend, __sys_aio_suspend), > SLOT(close, __sys_close), > SLOT(connect, __sys_connect), > - SLOT(fcntl, __fcntl_compat), > + SLOT(fcntl, __sys_fcntl), > SLOT(fsync, __sys_fsync), > SLOT(fork, __sys_fork), > SLOT(msync, __sys_msync), > diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c > deleted file mode 100644 > index a086be1..0000000 > --- a/lib/libc/sys/lseek.c > +++ /dev/null > @@ -1,56 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -off_t > -lseek(fd, offset, whence) > - int fd; > - off_t offset; > - int whence; > -{ > - > - if (__getosreldate() >= 700051) > - return(__sys_lseek(fd, offset, whence)); > - else > - return(__sys_freebsd6_lseek(fd, 0, offset, whence)); > -} > diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c > deleted file mode 100644 > index 0fa03ba..0000000 > --- a/lib/libc/sys/mmap.c > +++ /dev/null > @@ -1,56 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -void * > -mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) > -{ > - > - if (__getosreldate() >= 700051) { > - return (__sys_mmap(addr, len, prot, flags, fd, offset)); > - } else { > - return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, > - offset)); > - } > -} > diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c > deleted file mode 100644 > index 7566566..0000000 > --- a/lib/libc/sys/pread.c > +++ /dev/null > @@ -1,57 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -ssize_t > -pread(fd, buf, nbyte, offset) > - int fd; > - void *buf; > - size_t nbyte; > - off_t offset; > -{ > - > - if (__getosreldate() >= 700051) > - return (__sys_pread(fd, buf, nbyte, offset)); > - else > - return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset)); > -} > diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c > deleted file mode 100644 > index d17ed29..0000000 > --- a/lib/libc/sys/pwrite.c > +++ /dev/null > @@ -1,56 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -ssize_t > -pwrite(fd, buf, nbyte, offset) > - int fd; > - const void *buf; > - size_t nbyte; > - off_t offset; > -{ > - if (__getosreldate() >= 700051) > - return (__sys_pwrite(fd, buf, nbyte, offset)); > - else > - return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset)); > -} > diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c > deleted file mode 100644 > index 375c9d9..0000000 > --- a/lib/libc/sys/truncate.c > +++ /dev/null > @@ -1,55 +0,0 @@ > -/* > - * Copyright (c) 1992, 1993 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 4. Neither the name of the University nor the names of its contributors > - * may be used to endorse or promote products derived from this software > - * without specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - */ > - > -#if defined(LIBC_SCCS) && !defined(lint) > -static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; > -#endif /* LIBC_SCCS and not lint */ > -#include > -__FBSDID("$FreeBSD$"); > - > -#include > -#include > -#include > -#include "libc_private.h" > - > -/* > - * This function provides 64-bit offset padding that > - * is not supplied by GCC 1.X but is supplied by GCC 2.X. > - */ > -int > -truncate(path, length) > - const char *path; > - off_t length; > -{ > - > - if (__getosreldate() >= 700051) > - return(__sys_truncate(path, length)); > - else > - return(__sys_freebsd6_truncate(path, 0, length)); > -} > diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c > index e71bf4a..a3c6151 100644 > --- a/lib/libthr/thread/thr_syscalls.c > +++ b/lib/libthr/thread/thr_syscalls.c > @@ -95,10 +95,6 @@ __FBSDID("$FreeBSD$"); > #include "libc_private.h" > #include "thr_private.h" > > -#ifdef SYSCALL_COMPAT > -extern int __fcntl_compat(int, int, ...); > -#endif > - > static int > __thr_accept(int s, struct sockaddr *addr, socklen_t *addrlen) > { > @@ -203,18 +199,10 @@ __thr_fcntl(int fd, int cmd, ...) > va_start(ap, cmd); > if (cmd == F_OSETLKW || cmd == F_SETLKW) { > _thr_cancel_enter(curthread); > -#ifdef SYSCALL_COMPAT > - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); > -#else > ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); > -#endif > _thr_cancel_leave(curthread, ret == -1); > } else { > -#ifdef SYSCALL_COMPAT > - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); > -#else > ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); > -#endif > } > va_end(ap); > > diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c > index 8fc1db9..213801a 100644 > --- a/sys/kern/sys_generic.c > +++ b/sys/kern/sys_generic.c > @@ -219,6 +219,7 @@ sys_pread(td, uap) > return(error); > } > > +#if defined(COMPAT_FREEBSD6) > int > freebsd6_pread(td, uap) > struct thread *td; > @@ -232,6 +233,7 @@ freebsd6_pread(td, uap) > oargs.offset = uap->offset; > return (sys_pread(td, &oargs)); > } > +#endif > > /* > * Scatter read system call. > @@ -430,6 +432,7 @@ sys_pwrite(td, uap) > return(error); > } > > +#if defined(COMPAT_FREEBSD6) > int > freebsd6_pwrite(td, uap) > struct thread *td; > @@ -443,6 +446,7 @@ freebsd6_pwrite(td, uap) > oargs.offset = uap->offset; > return (sys_pwrite(td, &oargs)); > } > +#endif > > /* > * Gather write system call. > diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master > index 09d38d4..9873868 100644 > --- a/sys/kern/syscalls.master > +++ b/sys/kern/syscalls.master > @@ -342,9 +342,9 @@ > int a4); } > ; XXX should be { int shmsys(int which, ...); } > 172 AUE_NULL UNIMPL nosys > -173 AUE_PREAD STD { ssize_t freebsd6_pread(int fd, void *buf, \ > +173 AUE_PREAD COMPAT6 { ssize_t pread(int fd, void *buf, \ > size_t nbyte, int pad, off_t offset); } > -174 AUE_PWRITE STD { ssize_t freebsd6_pwrite(int fd, \ > +174 AUE_PWRITE COMPAT6 { ssize_t pwrite(int fd, \ > const void *buf, \ > size_t nbyte, int pad, off_t offset); } > 175 AUE_NULL STD { int setfib(int fibnum); } > @@ -376,16 +376,16 @@ > __setrlimit_args int > 196 AUE_GETDIRENTRIES STD { int getdirentries(int fd, char *buf, \ > u_int count, long *basep); } > -197 AUE_MMAP STD { caddr_t freebsd6_mmap(caddr_t addr, \ > +197 AUE_MMAP COMPAT6 { caddr_t mmap(caddr_t addr, \ > size_t len, int prot, int flags, int fd, \ > int pad, off_t pos); } > 198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ > __syscall_args int > -199 AUE_LSEEK STD { off_t freebsd6_lseek(int fd, int pad, \ > +199 AUE_LSEEK COMPAT6 { off_t lseek(int fd, int pad, \ > off_t offset, int whence); } > -200 AUE_TRUNCATE STD { int freebsd6_truncate(char *path, int pad, \ > +200 AUE_TRUNCATE COMPAT6 { int truncate(char *path, int pad, \ > off_t length); } > -201 AUE_FTRUNCATE STD { int freebsd6_ftruncate(int fd, int pad, \ > +201 AUE_FTRUNCATE COMPAT6 { int ftruncate(int fd, int pad, \ > off_t length); } > 202 AUE_SYSCTL STD { int __sysctl(int *name, u_int namelen, \ > void *old, size_t *oldlenp, void *new, \ > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c > index 8c8ca31..c5c479d 100644 > --- a/sys/kern/vfs_syscalls.c > +++ b/sys/kern/vfs_syscalls.c > @@ -1933,6 +1933,7 @@ olseek(td, uap) > } > #endif /* COMPAT_43 */ > > +#if defined(COMPAT_FREEBSD6) > /* Version with the 'pad' argument */ > int > freebsd6_lseek(td, uap) > @@ -1946,6 +1947,7 @@ freebsd6_lseek(td, uap) > ouap.whence = uap->whence; > return (sys_lseek(td, &ouap)); > } > +#endif > > /* > * Check access permissions using passed credentials. > @@ -3423,6 +3425,7 @@ otruncate(td, uap) > } > #endif /* COMPAT_43 */ > > +#if defined(COMPAT_FREEBSD6) > /* Versions with the pad argument */ > int > freebsd6_truncate(struct thread *td, struct freebsd6_truncate_args *uap) > @@ -3443,6 +3446,7 @@ freebsd6_ftruncate(struct thread *td, struct freebsd6_ftruncate_args *uap) > ouap.length = uap->length; > return (sys_ftruncate(td, &ouap)); > } > +#endif > > /* > * Sync an open file. > diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c > index a9ff248..02634d6 100644 > --- a/sys/vm/vm_mmap.c > +++ b/sys/vm/vm_mmap.c > @@ -462,6 +462,7 @@ done: > return (error); > } > > +#if defined(COMPAT_FREEBSD6) > int > freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) > { > @@ -475,6 +476,7 @@ freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) > oargs.pos = uap->pos; > return (sys_mmap(td, &oargs)); > } > +#endif > > #ifdef COMPAT_43 > #ifndef _SYS_SYSPROTO_H_ Is there any chanche to get ride of the very old (FreeBSD 2.x) compat hacks like these: https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ? I like the idea, to purge out the old stuffs/hacks from the FreeBSD. > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 12:08:53 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A744E0A; Fri, 17 Apr 2015 12:08:53 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D562A779; Fri, 17 Apr 2015 12:08:52 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Yj54d-0004TD-Lf; Fri, 17 Apr 2015 15:08:43 +0300 Date: Fri, 17 Apr 2015 15:08:43 +0300 From: Slawa Olhovchenkov To: Konstantin Belousov Cc: arch@freebsd.org, peter@freebsd.org Subject: Re: Removal of the 6.x kernel compat code from libc Message-ID: <20150417120843.GQ1394@zxy.spb.ru> References: <20150417075942.GI2390@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150417075942.GI2390@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 12:08:53 -0000 On Fri, Apr 17, 2015 at 10:59:42AM +0300, Konstantin Belousov wrote: > Our libc changes in sync with the kernel, but switching of libc to use > new interfaces means that upgrade of the userspace becomes the flag day. > People usually add backward-compatible shims for libc to use older > interfaces on old kernels. > > There is no reason to keep the compat shims after many years of the > transition. Patch below purges the compat code for pre-r171219, which > added pad-less versions of syscalls taking off_t, and for r177911, which > handles the struct flock/oflock transition. This is 6.x/7.x compat, > we absolutely not support running HEAD libc on such old kernels. In general, what purpose for leaving conditional compilation for different versions in kernel/base sources? subversion repo already store different version in correlation. From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 12:10:40 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C265FBF; Fri, 17 Apr 2015 12:10:40 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EE1F82A; Fri, 17 Apr 2015 12:10:39 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3HCAYg7031370 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 17 Apr 2015 15:10:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3HCAYg7031370 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3HCAYJg031369; Fri, 17 Apr 2015 15:10:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2015 15:10:34 +0300 From: Konstantin Belousov To: Oliver Pinter Cc: "freebsd-arch@freebsd.org" , peter@freebsd.org Subject: Re: Removal of the 6.x kernel compat code from libc Message-ID: <20150417121034.GN2390@kib.kiev.ua> References: <20150417075942.GI2390@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 12:10:40 -0000 On Fri, Apr 17, 2015 at 01:39:04PM +0200, Oliver Pinter wrote: > > Is there any chanche to get ride of the very old (FreeBSD 2.x) compat > hacks like these: > https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ? I will clean up setproctitle.c after the posted pieces of libc changes are committed. Apparently, there is no other direct uses of getosreldate() in libc, besides ones from the patch posted and futimens()/utimensat(). The later must stay for quite a time. > > I like the idea, to purge out the old stuffs/hacks from the FreeBSD. From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:08:05 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C406220A; Fri, 17 Apr 2015 13:08:05 +0000 (UTC) Received: from mailout06.t-online.de (mailout06.t-online.de [194.25.134.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout00.t-online.de", Issuer "TeleSec ServerPass DE-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82E66DDF; Fri, 17 Apr 2015 13:08:05 +0000 (UTC) Received: from fwd05.aul.t-online.de (fwd05.aul.t-online.de [172.20.27.149]) by mailout06.t-online.de (Postfix) with SMTP id E6F5445E78A; Fri, 17 Apr 2015 15:07:56 +0200 (CEST) Received: from [192.168.119.11] (ZG0T-kZVrh01ZzjxVUKyQTnVRSk8Rjhi0KUNSazwe93zt-AsJPUTc3yZOMxvce2w-G@[84.154.96.188]) by fwd05.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1Yj5zv-1wMTFQ0; Fri, 17 Apr 2015 15:07:55 +0200 Message-ID: <5531059F.4060500@freebsd.org> Date: Fri, 17 Apr 2015 15:07:43 +0200 From: Stefan Esser User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Konstantin Belousov , "freebsd-arch@freebsd.org" CC: Oliver Pinter , peter@freebsd.org Subject: Re: Removal of the 6.x kernel compat code from libc References: <20150417075942.GI2390@kib.kiev.ua> <20150417121034.GN2390@kib.kiev.ua> In-Reply-To: <20150417121034.GN2390@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-ID: ZG0T-kZVrh01ZzjxVUKyQTnVRSk8Rjhi0KUNSazwe93zt-AsJPUTc3yZOMxvce2w-G X-TOI-MSGID: b3979033-b9bc-41f6-9947-ab4b692d4eb8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:08:05 -0000 Am 17.04.2015 um 14:10 schrieb Konstantin Belousov: > On Fri, Apr 17, 2015 at 01:39:04PM +0200, Oliver Pinter wrote: >> >> Is there any chanche to get ride of the very old (FreeBSD 2.x) compat >> hacks like these: >> https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/setproctitle.c#L40 ? > > I will clean up setproctitle.c after the posted pieces of libc changes are > committed. > > Apparently, there is no other direct uses of getosreldate() in libc, > besides ones from the patch posted and futimens()/utimensat(). The later > must stay for quite a time. > >> >> I like the idea, to purge out the old stuffs/hacks from the FreeBSD. Could we get rid of check_utility_compat(3) on that occasion? It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of expr(1), which can also be selected with option "-e" and env variable COMPAT_EXPR. I doubt that anybody relies on non-POSIX behaviour that has been deprecated for some 15 years ... We'll need to preserve a stub function for check_utility_compat(3), I'm afraid, but I think we can remove the environment variable and the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util" at startup of expr. (I bet, nobody even knew that the behaviour of expr could be changed with above sym-link ...) If there is consensus, I could prepare a patch to remove the check and to update the man-page for expr (just for -CURRENT, no MFC). Regards, STefan From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:30:51 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 194ED99B; Fri, 17 Apr 2015 13:30:51 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98E310C; Fri, 17 Apr 2015 13:30:50 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E55BDB924; Fri, 17 Apr 2015 09:30:49 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org, peter@freebsd.org Cc: Konstantin Belousov Subject: Re: Removal of the 6.x kernel compat code from libc Date: Fri, 17 Apr 2015 09:29:38 -0400 Message-ID: <3447437.tTGu6eNHtf@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <20150417075942.GI2390@kib.kiev.ua> References: <20150417075942.GI2390@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 09:30:50 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:30:51 -0000 On Friday, April 17, 2015 10:59:42 AM Konstantin Belousov wrote: > Our libc changes in sync with the kernel, but switching of libc to use > new interfaces means that upgrade of the userspace becomes the flag day. > People usually add backward-compatible shims for libc to use older > interfaces on old kernels. > > There is no reason to keep the compat shims after many years of the > transition. Patch below purges the compat code for pre-r171219, which > added pad-less versions of syscalls taking off_t, and for r177911, which > handles the struct flock/oflock transition. This is 6.x/7.x compat, > we absolutely not support running HEAD libc on such old kernels. I think this is fine. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:30:53 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 330CC9A1 for ; Fri, 17 Apr 2015 13:30:53 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EEDD10F for ; Fri, 17 Apr 2015 13:30:53 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1EE84B94C; Fri, 17 Apr 2015 09:30:52 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Yue Chen Subject: Re: Situations about PC values in kernel data segments Date: Fri, 17 Apr 2015 09:22:43 -0400 Message-ID: <6048769.xVxqkDkTGK@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 09:30:52 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:30:53 -0000 On Saturday, April 11, 2015 05:18:28 AM Yue Chen wrote: > Dear all, > > We are working on a project about OS security. > We wonder in which situations the program counter (PC) value (e.g., the > value in %RIP on x86_64, i.e, instruction address) could be in kernel > (module) data segments (including stack, heap, etc.). > > Here we mainly care about the address/value that are NOT function entry > points since there exist a number of function pointers. Also, we only > consider the normal cases because one can write arbitrary values into a > variable/pointer. And we mainly consider i386, AMD64 and ARM. > > Here are some situations I can think about: > function/interrupt/exception/syscall return address on stack; switch/case > jump table target; page fault handler (pcb_onfault on *BSD); restartable > atomic sequences (RAS) registry; thread/process context structure like Task > state segment (TSS), process control block (PCB) and thread control block > (TCB); situations for debugging purposes (e.g., like those in ``segment not > present'' exception handler). > > Additionally, does any of these addresses have offset formats or special > encodings? For example, on x86_64, we may use 32-bit RIP-relative > (addressing) offset to represent a 64-bit full address. In glibc's > setjmp/longjmp jmp_buf, they use a special encoding (PTR_MANGLE) for saved > register values. For i386 and amd64, I think all of the code that is executed does live in a .text segment. When pcb_onfault is used it is set to point to code in a .text segment, not anywhere else. Similarly, fault and exception handlers as well as the stub for new threads/processes after fork/thread_create is in .text as well. There are multiple text segments present when modules are loaded of course, but you should be able to enumerate all of those in the linker. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:30:51 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CCDAF99D; Fri, 17 Apr 2015 13:30:51 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A60B210D; Fri, 17 Apr 2015 13:30:51 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 91C72B93A; Fri, 17 Apr 2015 09:30:50 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Stefan Esser , Konstantin Belousov , "freebsd-arch@freebsd.org" , peter@freebsd.org, Oliver Pinter Subject: Re: Removal of the 6.x kernel compat code from libc Date: Fri, 17 Apr 2015 09:28:24 -0400 Message-ID: <14081053.n6WdaDRXXc@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <5531059F.4060500@freebsd.org> References: <20150417075942.GI2390@kib.kiev.ua> <20150417121034.GN2390@kib.kiev.ua> <5531059F.4060500@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 09:30:50 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:30:51 -0000 On Friday, April 17, 2015 03:07:43 PM Stefan Esser wrote: > Could we get rid of check_utility_compat(3) on that occasion? > > It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of > expr(1), which can also be selected with option "-e" and env variable > COMPAT_EXPR. > > I doubt that anybody relies on non-POSIX behaviour that has been > deprecated for some 15 years ... > > We'll need to preserve a stub function for check_utility_compat(3), > I'm afraid, but I think we can remove the environment variable and > the actual checking for a sym-link named "/etc/compat-FreeBSD-4-util" > at startup of expr. (I bet, nobody even knew that the behaviour of > expr could be changed with above sym-link ...) > > If there is consensus, I could prepare a patch to remove the check > and to update the man-page for expr (just for -CURRENT, no MFC). I would not be surprised if Y!BSD depends on this and uses it in 11 FWIW. :) -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:30:52 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DC839A0 for ; Fri, 17 Apr 2015 13:30:52 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AC4610E for ; Fri, 17 Apr 2015 13:30:52 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 604C6B94B; Fri, 17 Apr 2015 09:30:51 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Konstantin Belousov Subject: Re: Make ppoll(2) and waitid(2) cancellation points Date: Fri, 17 Apr 2015 09:26:23 -0400 Message-ID: <1618723.JaybXFdLjb@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <20150417075933.GH2390@kib.kiev.ua> References: <20150417075933.GH2390@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 09:30:51 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:30:52 -0000 On Friday, April 17, 2015 10:59:33 AM Konstantin Belousov wrote: > Patch below makes ppoll(2) and waitid(2) cancellable. > > The waitid(2) is required to be a cancellation point by POSIX, so the > change fixes a definite bug. It is done by making wait6() cancellable, > in line with the other wait*(2) syscalls. > > For ppoll(2), our other select/poll interfaces are cancel points, i.e. > select, pselect, and poll. It is reasonable for ppoll() to follow the > suite. > > The interposing table was extended at the end, instead of ordering new > interposers by alphabet. It would be acceptable, but makes it easier > for people to run new libc with older libthr (although not supported). Sounds good to me. > diff --git a/lib/libc/sys/wait6.c b/lib/libc/sys/wait6.c > new file mode 100644 > index 0000000..f0e2999 > --- /dev/null > +++ b/lib/libc/sys/wait6.c > @@ -0,0 +1,52 @@ > +/* > + * Copyright (c) 2014 The FreeBSD Foundation. > + * All rights reserved. s/2014/2015/? -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:30:54 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2542A9A6; Fri, 17 Apr 2015 13:30:54 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF762110; Fri, 17 Apr 2015 13:30:53 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EA241B962; Fri, 17 Apr 2015 09:30:52 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Bryan Drewery Subject: Re: [RFC] SA/EN ABI/Lib flagging for package rebuilding Date: Fri, 17 Apr 2015 09:08:46 -0400 Message-ID: <3952433.yB8VVSoaLQ@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <5526B8E0.1090403@FreeBSD.org> References: <5526B8E0.1090403@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 09:30:53 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:30:54 -0000 On Thursday, April 09, 2015 12:37:36 PM Bryan Drewery wrote: > Currently for any SA/EN we force rebuild all packages for > pkg.freebsd.org. This is a very time-consuming process at 24 hours for > each set and 10 (non-head) sets to build. > > We really only need to rebuild packages if ABI/KBI is changed (which I > would think would happen almost never) or if a library is updated. The > library being updated needs a rebuild in case of packages linking > against the library statically. There's no quick way to determine what > package may be infected by a static linkage to a library so we just > rebuild them all. > > There are 2 somewhat conflicting goals here. We need head packages to be > usable on all ABI/KBI changes. The simplest here was decided to just > rebuilding head packages always. This is a compromise I am willing to > accept. I had wanted to use __FreeBSD_version for this in the past but > it tends to be missed or bumped gratuitously. > > > My idea to cover both cases so that packages will only rebuild if the > public API or libraries change in the jail or anything else which > affects the resulting binaries. > > I will take a checksum of the following and if anything differs then do > a rebuild: > > /lib /usr/lib /libexec (.so included due to symbol versioning and > detecting added/removed libraries which can change packages) > /usr/include (all public API for the system including kernel API for > modules) > /usr/libdata > > That is all I am aware of for the public API/KPI/ABI/KBI that is > relevant for packages. > > I also realize I need to include some of the binutils files as they may > change how binaries are produced. This is all of 'ar as ld nm objcopy > objdump ranlib readelf strip' in /usr/bin/. Also all of GCC/Clang > binaries in /usr/bin: 'cc clang clang++ clang-cpp clang-tblgen cpp > c++filt CC c++ g++ gcc gnu-ar gnu-ranlib'. > > I don't want to consider all of /bin /usr/bin /sbin and /usr/sbin as it > catches SA that do not really need a rebuild, such as > FreeBSD-SA-15:07.ntp which modified /usr/sbin/ntpd. > > By having a whitelist of files from *bin* I risk not rebuilding in a > rare case where /bin/sh or /bin/cp (random example) had a vulnerability > fixed in them that could change resulting binaries. I consider that to > be very unlikely though. Perhaps for head packages it is more relevant > but I still consider it unlikely other changes will require rebuilding > packages. > > If I forgot other critical pieces from *bin* please list them. > > An alternative would be for there to be a reliable flag in head and > SA/EN noting whether binaries need to be rebuilt. There had been a > technical limitation to bumping __FreeBSD_version for SA as it would > modify all binaries. I think that was fixed. Portmgr fought hard to > always have __FreeBSD_version bumped but that's a lost cause. As I > mentioned I don't trust this flag in head either. I also want __FreeBSD_version always bumped for SA/EN, but secteam@ actively refuses to do this, even after being explicitly told to do so by core@. :( Regardless, I think your approach is more robust than hoping developers remember to bump the version for any API/ABI change. Looking at your proposed list I can only think of a few other binaries that matter, in particular code-generators like lex, yacc, and rpcgen. I don't claim that that list is exhaustive, but I do think it is a class of binaries that were not in your list. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:43:54 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D42519D; Fri, 17 Apr 2015 13:43:54 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D07E42FC; Fri, 17 Apr 2015 13:43:53 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3HDhmgh052652 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 17 Apr 2015 16:43:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3HDhmgh052652 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3HDhmQv052651; Fri, 17 Apr 2015 16:43:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2015 16:43:48 +0300 From: Konstantin Belousov To: John Baldwin Cc: freebsd-arch@freebsd.org, Yue Chen Subject: Re: Situations about PC values in kernel data segments Message-ID: <20150417134348.GR2390@kib.kiev.ua> References: <6048769.xVxqkDkTGK@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6048769.xVxqkDkTGK@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:43:54 -0000 On Fri, Apr 17, 2015 at 09:22:43AM -0400, John Baldwin wrote: > On Saturday, April 11, 2015 05:18:28 AM Yue Chen wrote: > > Dear all, > > > > We are working on a project about OS security. > > We wonder in which situations the program counter (PC) value (e.g., the > > value in %RIP on x86_64, i.e, instruction address) could be in kernel > > (module) data segments (including stack, heap, etc.). > > > > Here we mainly care about the address/value that are NOT function entry > > points since there exist a number of function pointers. Also, we only > > consider the normal cases because one can write arbitrary values into a > > variable/pointer. And we mainly consider i386, AMD64 and ARM. > > > > Here are some situations I can think about: > > function/interrupt/exception/syscall return address on stack; switch/case > > jump table target; page fault handler (pcb_onfault on *BSD); restartable > > atomic sequences (RAS) registry; thread/process context structure like Task > > state segment (TSS), process control block (PCB) and thread control block > > (TCB); situations for debugging purposes (e.g., like those in ``segment not > > present'' exception handler). > > > > Additionally, does any of these addresses have offset formats or special > > encodings? For example, on x86_64, we may use 32-bit RIP-relative > > (addressing) offset to represent a 64-bit full address. In glibc's > > setjmp/longjmp jmp_buf, they use a special encoding (PTR_MANGLE) for saved > > register values. > > For i386 and amd64, I think all of the code that is executed does live in a > .text segment. When pcb_onfault is used it is set to point to code in a .text > segment, not anywhere else. Similarly, fault and exception handlers as well > as the stub for new threads/processes after fork/thread_create is in .text > as well. There are multiple text segments present when modules are loaded > of course, but you should be able to enumerate all of those in the linker. Wasn't bpf enhanced to compile filters to the native code, on x86 ? Also, what about BIOS code ? Esp. since the spread of UEFI and hope that our kernel starts using UEFI runtime services one day. My point is that _relying_ on enumeration of the text segments for kernel and modules to determine all executable memory is not correct. From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:46:38 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BEF142B7 for ; Fri, 17 Apr 2015 13:46:38 +0000 (UTC) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) (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 91DFC324 for ; Fri, 17 Apr 2015 13:46:38 +0000 (UTC) Received: by pabsx10 with SMTP id sx10so125863261pab.3 for ; Fri, 17 Apr 2015 06:46:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=bQRn7Kzz/+Fc2XPUxREtdSr61KWHhNExGdUjaSmwvcg=; b=g0xyfe7om5ZqVrG/EQD4jfG2M3hvFKdK7aFumhNzZwYV0DoTFeg0zZwpYYftndpGhr 6598S0cI22tWddtbrJOZGo26NjCihnSKoii6Y3Wm2dDG6PzcR4x73eEDCjyw6VPhKAdw sXs5meVA0ugErXgb2Cxi/eeQvDu1IGGHOpYFSkCIUbZdbGrxi3z1EAYLQk+ih1L4eVim tR+o3HJKUuIj+iXCfMwypsXhx1xb+bPk9T1WsHpRtaw12aDzWab8lEvlvIx7ld2LafIx M9KiBATr9b7YCUIuAKCgqV/Ut0lRP0Atv2O9UI/zJCf1hxeHLa3qZh6uLvg6S9IT+3jJ pT9w== X-Gm-Message-State: ALoCoQkPrxA19avuM0rBa1JL/BXs1qtEy6ChXpECs2fXZ57S/zAGHag+GbyuxkhAHpsTI4BsCU+Z X-Received: by 10.70.53.40 with SMTP id y8mr5668721pdo.61.1429278392701; Fri, 17 Apr 2015 06:46:32 -0700 (PDT) Received: from [10.64.24.57] ([69.53.236.236]) by mx.google.com with ESMTPSA id do6sm10244706pdb.72.2015.04.17.06.46.31 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 06:46:32 -0700 (PDT) Sender: Warner Losh Subject: Re: Situations about PC values in kernel data segments Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: multipart/signed; boundary="Apple-Mail=_C4A5E184-8E8A-49AF-A629-C6F22D6BC994"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b6 From: Warner Losh In-Reply-To: <20150417134348.GR2390@kib.kiev.ua> Date: Fri, 17 Apr 2015 07:46:29 -0600 Cc: John Baldwin , Yue Chen , freebsd-arch@freebsd.org Message-Id: <53A884B1-3F07-40EE-BFBB-16EBC39DAF7A@bsdimp.com> References: <6048769.xVxqkDkTGK@ralph.baldwin.cx> <20150417134348.GR2390@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:46:38 -0000 --Apple-Mail=_C4A5E184-8E8A-49AF-A629-C6F22D6BC994 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 17, 2015, at 7:43 AM, Konstantin Belousov = wrote: >=20 > On Fri, Apr 17, 2015 at 09:22:43AM -0400, John Baldwin wrote: >> On Saturday, April 11, 2015 05:18:28 AM Yue Chen wrote: >>> Dear all, >>>=20 >>> We are working on a project about OS security. >>> We wonder in which situations the program counter (PC) value (e.g., = the >>> value in %RIP on x86_64, i.e, instruction address) could be in = kernel >>> (module) data segments (including stack, heap, etc.). >>>=20 >>> Here we mainly care about the address/value that are NOT function = entry >>> points since there exist a number of function pointers. Also, we = only >>> consider the normal cases because one can write arbitrary values = into a >>> variable/pointer. And we mainly consider i386, AMD64 and ARM. >>>=20 >>> Here are some situations I can think about: >>> function/interrupt/exception/syscall return address on stack; = switch/case >>> jump table target; page fault handler (pcb_onfault on *BSD); = restartable >>> atomic sequences (RAS) registry; thread/process context structure = like Task >>> state segment (TSS), process control block (PCB) and thread control = block >>> (TCB); situations for debugging purposes (e.g., like those in = ``segment not >>> present'' exception handler). >>>=20 >>> Additionally, does any of these addresses have offset formats or = special >>> encodings? For example, on x86_64, we may use 32-bit RIP-relative >>> (addressing) offset to represent a 64-bit full address. In glibc's >>> setjmp/longjmp jmp_buf, they use a special encoding (PTR_MANGLE) for = saved >>> register values. >>=20 >> For i386 and amd64, I think all of the code that is executed does = live in a >> .text segment. When pcb_onfault is used it is set to point to code = in a .text >> segment, not anywhere else. Similarly, fault and exception handlers = as well >> as the stub for new threads/processes after fork/thread_create is in = .text >> as well. There are multiple text segments present when modules are = loaded >> of course, but you should be able to enumerate all of those in the = linker. >=20 > Wasn't bpf enhanced to compile filters to the native code, on x86 ? > Also, what about BIOS code ? Esp. since the spread of UEFI and hope = that > our kernel starts using UEFI runtime services one day. My point is = that > _relying_ on enumeration of the text segments for kernel and modules = to > determine all executable memory is not correct. Yes. That =E2=80=98one day=E2=80=99 will be quite soon=E2=80=A6 I have = patches in my patch queue which should do the right thing. Warner --Apple-Mail=_C4A5E184-8E8A-49AF-A629-C6F22D6BC994 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVMQ61AAoJEGwc0Sh9sBEAv5UP/29Efbs4GPlHNXMksdWbQbiC jVAQOLkdakb3/XByViQ7/txOZeHCLzY5+d8v+8IgKGvdnzHjgADJqcUmgYUgJ6Dl JukRhC2jar0ePemJqR9oVwTMY/rwoaNYOJBPiDZdyJdMyt4Nlt4WaT+ONg4Hp2f8 AOw+qz2yv9LrtASP45VVvJJ72ULs9LrownJFGf3rg0cdTB9ZY/Zt/n1bRtNI8l8f OwqpCzrKVC0OS29iXY/dH+UTSOeyN1Qz+OFnWaQNl0DJmhcFYH1DCzhJ4qaYqJZz NpHMPLtHS5xxagcw/TpvXgNnsMeohm5XHa/cpKtX+3jKJvO/A9ayHhJCqRlAzR/P hu/5IQRJdQtO3pDmPFFCpGWDmkBbB7FTdFhFt0/sqQeuj77IgNumpWtyW8BrXeHJ 2l5Es8kBJExhePYO/IaKJ5By8TQ0jCYAYdl0om162u4VxcaI120Gf5KGXd1rvoHs 5Tv53zw7Kh9Wnk5SqWLdeOEs141IzwVbIQQEF57YmZWkZrGxiTzZ+PsFMYrMWUP5 ZFHQ/BzcM3UkeIZxDculI0fXfwwK9owz1ohaE4OssxkRJPt3i6x0dou+DseXkIGU jUOv6AlUh1G2UyG88fqj8H/AAm+KPiS8QhqwocS77jjZKjdLphTQKdtzSc6yUQt8 j6PFpcIVJvPoWxC9laEh =GeTM -----END PGP SIGNATURE----- --Apple-Mail=_C4A5E184-8E8A-49AF-A629-C6F22D6BC994-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 13:54:11 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1500A484 for ; Fri, 17 Apr 2015 13:54:11 +0000 (UTC) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) (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 DAA8C5FF for ; Fri, 17 Apr 2015 13:54:10 +0000 (UTC) Received: by pdbqa5 with SMTP id qa5so128890656pdb.1 for ; Fri, 17 Apr 2015 06:54:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=I2elQfI5+457SrwryEZjFX9fAB16PSS7pmrnekKIgbU=; b=PqwAY1cNAciCTzst2mIhmf41bzN6Vya1gJ++Q8rNoTIk5ajK/kKuhHJ8/9uO4cL3A7 8ETSP0EW1J3+FhAPySpVOL7OY6tYcOQIUZdbVfRP72GYjXsSkqZkCPVEoa4GA+odH1kj XlB7LXkyM/PkeKH3V+b1GWqcN6y+JP8ZduAcAAO6NRUq1E/RT2ra5kpTPm0KRpHtj63B KcP0dlfbp5IBq8ZCfFPtSlGxqepcNf5okL9+b1LL8iDS+PbdyqWFJMsANQw2Jz+QUcm/ JXWLI3Pmqdsbn37D7o/1icQDjcJBLw919SwQj0j1bXJ9L8Y69NlUQNyIm4ZvnJFOie2j o8aQ== X-Gm-Message-State: ALoCoQmjg12uUSxjxomjLACeGGyta6onD28CgQfwh0pLn341Zb94CAbF8u3viAiWonnxWVLXo7Ub X-Received: by 10.66.162.165 with SMTP id yb5mr2767832pab.32.1429278844565; Fri, 17 Apr 2015 06:54:04 -0700 (PDT) Received: from [10.64.24.57] ([69.53.236.236]) by mx.google.com with ESMTPSA id bs4sm10272718pbc.3.2015.04.17.06.54.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 06:54:03 -0700 (PDT) Sender: Warner Losh Subject: Re: Removal of the 6.x kernel compat code from libc Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: multipart/signed; boundary="Apple-Mail=_B6C74F8F-736C-473D-ADC9-A0E20AA9535B"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b6 From: Warner Losh In-Reply-To: <3447437.tTGu6eNHtf@ralph.baldwin.cx> Date: Fri, 17 Apr 2015 07:54:01 -0600 Cc: freebsd-arch@freebsd.org, peter@freebsd.org, Konstantin Belousov Message-Id: References: <20150417075942.GI2390@kib.kiev.ua> <3447437.tTGu6eNHtf@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 13:54:11 -0000 --Apple-Mail=_B6C74F8F-736C-473D-ADC9-A0E20AA9535B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 17, 2015, at 7:29 AM, John Baldwin wrote: >=20 > On Friday, April 17, 2015 10:59:42 AM Konstantin Belousov wrote: >> Our libc changes in sync with the kernel, but switching of libc to = use >> new interfaces means that upgrade of the userspace becomes the flag = day. >> People usually add backward-compatible shims for libc to use older >> interfaces on old kernels. >>=20 >> There is no reason to keep the compat shims after many years of the >> transition. Patch below purges the compat code for pre-r171219, = which >> added pad-less versions of syscalls taking off_t, and for r177911, = which >> handles the struct flock/oflock transition. This is 6.x/7.x compat, >> we absolutely not support running HEAD libc on such old kernels. >=20 > I think this is fine. I do too. Please look at removing MK_COMPAT_SYSCALLS from the build too, since it was the only knob that controlled these. I don=E2=80=99t see that in = your patch (though it would be easier for me to comment on in phabricator). Also, in lib/libc/sys/fcnt.c: + * Copyright (c) 2014, 2015 The FreeBSD Foundation. Should be 2014-2015 Warner --Apple-Mail=_B6C74F8F-736C-473D-ADC9-A0E20AA9535B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVMRB5AAoJEGwc0Sh9sBEAJtMQALwot43hq+keyxlp3PAxUyXJ 0e7SqAUAyli/3AJ5xbXPkXu8js8BQjpIwI04KbXUsDvd7h8Mahv5+e9yK/xJz11T 68BR6xBJLXbiPVgNoCrNIChe/JaXqnhsllfW83VUSpoZi45aQnjmFDp4v9PBPO8c qjq/ioRQ8TH++37CXmxBCumaKNtUP1y3iqsJLGnifyp/STWpg43gbkcbIUmclZMd mzjN8uNxVPP9LxvxCdVpxPISDKfcT8aiKtv30K2CZ92IE1Me7u+yVgssjwZ2X25U ij2jVX3nHsHr9VseW+EMEhor51uD+SlsJxk8bJNRwxyo0UHcboc1AXaIofkcwuJY ZkTTZEHxM/T+/EgQUGOcWaGHZs9qbmumIY++rl2hpHqmCT4vhU+qBFbVAIjIxTaG wH+Vsr/YQCRqJao4k64yTcQo3sAHOzoJ52Wffe7XR0TXQ/CgZok/iubDacwkSPoO uobgDLxNbiGFkd7vT2Hsqk7oaSA6XmToHOm8+GL8aVxWKPs0iYfDeVldVxTr1tOI LEugpCFR6MmIIqywSXoXgsMuRj3uysRLiCME4weSh8FYRanz1v5fwOcG937TZT4R bU1IHL+Q8MOaD4ZrE7PTJ3ScrhSnVmxeNzCQY49FWIRuMnDf5D0ne1j6ObItApNU jH2QHstyMpn8O/yDD3ue =t+KZ -----END PGP SIGNATURE----- --Apple-Mail=_B6C74F8F-736C-473D-ADC9-A0E20AA9535B-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 14:12:06 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1A939BD; Fri, 17 Apr 2015 14:12:05 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BD08889; Fri, 17 Apr 2015 14:12:05 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3HEBoT8059587 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 17 Apr 2015 17:11:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3HEBoT8059587 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3HEBoOL059586; Fri, 17 Apr 2015 17:11:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2015 17:11:50 +0300 From: Konstantin Belousov To: Warner Losh Cc: John Baldwin , freebsd-arch@freebsd.org, peter@freebsd.org Subject: Re: Removal of the 6.x kernel compat code from libc Message-ID: <20150417141150.GT2390@kib.kiev.ua> References: <20150417075942.GI2390@kib.kiev.ua> <3447437.tTGu6eNHtf@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 14:12:06 -0000 On Fri, Apr 17, 2015 at 07:54:01AM -0600, Warner Losh wrote: > > > On Apr 17, 2015, at 7:29 AM, John Baldwin wrote: > > > > On Friday, April 17, 2015 10:59:42 AM Konstantin Belousov wrote: > >> Our libc changes in sync with the kernel, but switching of libc to use > >> new interfaces means that upgrade of the userspace becomes the flag day. > >> People usually add backward-compatible shims for libc to use older > >> interfaces on old kernels. > >> > >> There is no reason to keep the compat shims after many years of the > >> transition. Patch below purges the compat code for pre-r171219, which > >> added pad-less versions of syscalls taking off_t, and for r177911, which > >> handles the struct flock/oflock transition. This is 6.x/7.x compat, > >> we absolutely not support running HEAD libc on such old kernels. > > > > I think this is fine. > > I do too. > > Please look at removing MK_COMPAT_SYSCALLS from the build too, since > it was the only knob that controlled these. I don???t see that in your patch > (though it would be easier for me to comment on in phabricator). Hm, I thought that this option was 'break the ABI' request, to drop non-default-versioned symbols. Apparently it is not, I remove the MK_COMPAT_SYSCALLS. Updated patch is at the end of the message. > > Also, in lib/libc/sys/fcnt.c: > > + * Copyright (c) 2014, 2015 The FreeBSD Foundation. > > Should be 2014-2015 This is fixed, thanks. diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 398dc54..8e0db62 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -157,10 +157,6 @@ libkern.${LIBC_ARCH}:: ${KMSRCS} ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} .endif -.if ${MK_SYSCALL_COMPAT} != "no" -CFLAGS+=-DSYSCALL_COMPAT -.endif - .include .include diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 8e0d614..46ea955 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -11,6 +11,3 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc index f36ab71..60c2dc3 100644 --- a/lib/libc/arm/sys/Makefile.inc +++ b/lib/libc/arm/sys/Makefile.inc @@ -8,6 +8,3 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _exit.o _getlogin.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc index b56183c..ebaa462 100644 --- a/lib/libc/i386/sys/Makefile.inc +++ b/lib/libc/i386/sys/Makefile.inc @@ -15,9 +15,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h index 2b8f0de..6ab17d7 100644 --- a/lib/libc/include/compat.h +++ b/lib/libc/include/compat.h @@ -47,9 +47,7 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); #define __weak_reference(sym,alias) \ .weak alias;.equ alias,sym -#ifndef SYSCALL_COMPAT __weak_reference(__sys_fcntl,__fcntl_compat) -#endif #undef __weak_reference diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index ceaa2a3..53be867 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -276,21 +276,12 @@ extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly - * ignores value of $OSVERSION and caches result. Prototypes - * for the wrapped "new" pad-less syscalls are here for now. + * ignores value of $OSVERSION and caches result. */ int __getosreldate(void); #include #include -/* With pad */ -__off_t __sys_freebsd6_lseek(int, int, __off_t, int); -int __sys_freebsd6_ftruncate(int, int, __off_t); -int __sys_freebsd6_truncate(const char *, int, __off_t); -__ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); -__ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); -void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); - struct aiocb; struct fd_set; struct iovec; diff --git a/lib/libc/mips/sys/Makefile.inc b/lib/libc/mips/sys/Makefile.inc index a0452c6..a06f664 100644 --- a/lib/libc/mips/sys/Makefile.inc +++ b/lib/libc/mips/sys/Makefile.inc @@ -10,6 +10,3 @@ NOASM= break.o exit.o ftruncate.o getlogin.o lseek.o mmap.o \ openbsd_poll.o pread.o pwrite.o sstk.o truncate.o vfork.o yield.o PSEUDO= _exit.o _getlogin.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc index ad98ba1..98ec888 100644 --- a/lib/libc/powerpc/sys/Makefile.inc +++ b/lib/libc/powerpc/sys/Makefile.inc @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc index ad98ba1..98ec888 100644 --- a/lib/libc/powerpc64/sys/Makefile.inc +++ b/lib/libc/powerpc64/sys/Makefile.inc @@ -6,6 +6,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc index 726c0c9..a62aac2 100644 --- a/lib/libc/sparc64/sys/Makefile.inc +++ b/lib/libc/sparc64/sys/Makefile.inc @@ -18,6 +18,3 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 7745b2a..b63aa89 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -26,18 +26,6 @@ SRCS+= \ __error.c \ interposing_table.c -.if ${MK_SYSCALL_COMPAT} != "no" -SYSCALL_COMPAT_SRCS= \ - ftruncate.c \ - lseek.c \ - mmap.c \ - pread.c \ - pwrite.c \ - truncate.c -SRCS+= ${SYSCALL_COMPAT_SRCS} -NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/} -.endif - SRCS+= futimens.c utimensat.c NOASM+= futimens.o utimensat.o PSEUDO+= _futimens.o _utimensat.o diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c index 7af617e..e85574a 100644 --- a/lib/libc/sys/fcntl.c +++ b/lib/libc/sys/fcntl.c @@ -3,6 +3,12 @@ * Authors: Doug Rabson * Developed with Red Inc: Alfred Perlstein * + * Copyright (c) 2014-2015 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -48,59 +54,3 @@ fcntl(int fd, int cmd, ...) return (((int (*)(int, int, ...)) __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); } - -#ifdef SYSCALL_COMPAT -__weak_reference(__fcntl_compat, __fcntl); - -int -__fcntl_compat(int fd, int cmd, ...) -{ - va_list args; - long arg; - struct __oflock ofl; - struct flock *flp; - int res; - - va_start(args, cmd); - arg = va_arg(args, long); - va_end(args); - - if (__getosreldate() >= 800028) { - return (__sys_fcntl(fd, cmd, arg)); - } else { - if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) { - /* - * Convert new-style struct flock (which - * includes l_sysid) to old-style. - */ - flp = (struct flock *) (uintptr_t) arg; - ofl.l_start = flp->l_start; - ofl.l_len = flp->l_len; - ofl.l_pid = flp->l_pid; - ofl.l_type = flp->l_type; - ofl.l_whence = flp->l_whence; - - switch (cmd) { - case F_GETLK: - res = __sys_fcntl(fd, F_OGETLK, &ofl); - if (res >= 0) { - flp->l_start = ofl.l_start; - flp->l_len = ofl.l_len; - flp->l_pid = ofl.l_pid; - flp->l_type = ofl.l_type; - flp->l_whence = ofl.l_whence; - flp->l_sysid = 0; - } - return (res); - - case F_SETLK: - return (__sys_fcntl(fd, F_OSETLK, &ofl)); - - case F_SETLKW: - return (__sys_fcntl(fd, F_OSETLKW, &ofl)); - } - } - return (__sys_fcntl(fd, cmd, arg)); - } -} -#endif diff --git a/lib/libc/sys/ftruncate.c b/lib/libc/sys/ftruncate.c deleted file mode 100644 index 78b5a36..0000000 --- a/lib/libc/sys/ftruncate.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -ftruncate(fd, length) - int fd; - off_t length; -{ - - if (__getosreldate() >= 700051) - return(__sys_ftruncate(fd, length)); - else - return(__sys_freebsd6_ftruncate(fd, 0, length)); -} diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c index 4290bc6..0ffc426 100644 --- a/lib/libc/sys/interposing_table.c +++ b/lib/libc/sys/interposing_table.c @@ -44,7 +44,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = { SLOT(aio_suspend, __sys_aio_suspend), SLOT(close, __sys_close), SLOT(connect, __sys_connect), - SLOT(fcntl, __fcntl_compat), + SLOT(fcntl, __sys_fcntl), SLOT(fsync, __sys_fsync), SLOT(fork, __sys_fork), SLOT(msync, __sys_msync), diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c deleted file mode 100644 index a086be1..0000000 --- a/lib/libc/sys/lseek.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -off_t -lseek(fd, offset, whence) - int fd; - off_t offset; - int whence; -{ - - if (__getosreldate() >= 700051) - return(__sys_lseek(fd, offset, whence)); - else - return(__sys_freebsd6_lseek(fd, 0, offset, whence)); -} diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c deleted file mode 100644 index 0fa03ba..0000000 --- a/lib/libc/sys/mmap.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -void * -mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) -{ - - if (__getosreldate() >= 700051) { - return (__sys_mmap(addr, len, prot, flags, fd, offset)); - } else { - return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, - offset)); - } -} diff --git a/lib/libc/sys/pread.c b/lib/libc/sys/pread.c deleted file mode 100644 index 7566566..0000000 --- a/lib/libc/sys/pread.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pread(fd, buf, nbyte, offset) - int fd; - void *buf; - size_t nbyte; - off_t offset; -{ - - if (__getosreldate() >= 700051) - return (__sys_pread(fd, buf, nbyte, offset)); - else - return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset)); -} diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c deleted file mode 100644 index d17ed29..0000000 --- a/lib/libc/sys/pwrite.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -ssize_t -pwrite(fd, buf, nbyte, offset) - int fd; - const void *buf; - size_t nbyte; - off_t offset; -{ - if (__getosreldate() >= 700051) - return (__sys_pwrite(fd, buf, nbyte, offset)); - else - return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset)); -} diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c deleted file mode 100644 index 375c9d9..0000000 --- a/lib/libc/sys/truncate.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "libc_private.h" - -/* - * This function provides 64-bit offset padding that - * is not supplied by GCC 1.X but is supplied by GCC 2.X. - */ -int -truncate(path, length) - const char *path; - off_t length; -{ - - if (__getosreldate() >= 700051) - return(__sys_truncate(path, length)); - else - return(__sys_freebsd6_truncate(path, 0, length)); -} diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 1acb17f..0770d06 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -61,10 +61,6 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif -.if ${MK_SYSCALL_COMPAT} != "no" -CFLAGS+=-DSYSCALL_COMPAT -.endif - .include .include diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index e71bf4a..a3c6151 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -95,10 +95,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "thr_private.h" -#ifdef SYSCALL_COMPAT -extern int __fcntl_compat(int, int, ...); -#endif - static int __thr_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { @@ -203,18 +199,10 @@ __thr_fcntl(int fd, int cmd, ...) va_start(ap, cmd); if (cmd == F_OSETLKW || cmd == F_SETLKW) { _thr_cancel_enter(curthread); -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif _thr_cancel_leave(curthread, ret == -1); } else { -#ifdef SYSCALL_COMPAT - ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); -#else ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); -#endif } va_end(ap); diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 6bcff64..f98e19f 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -154,7 +154,6 @@ __DEFAULT_YES_OPTIONS = \ SOURCELESS_HOST \ SOURCELESS_UCODE \ SVNLITE \ - SYSCALL_COMPAT \ SYSCONS \ SYSINSTALL \ TALK \ @@ -235,8 +234,6 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC .endif .if ${__T} == "aarch64" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB -# There was no support for arm64 prior to FreeBSD 11 -BROKEN_OPTIONS+=SYSCALL_COMPAT .endif .include diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 8fc1db9..213801a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -219,6 +219,7 @@ sys_pread(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pread(td, uap) struct thread *td; @@ -232,6 +233,7 @@ freebsd6_pread(td, uap) oargs.offset = uap->offset; return (sys_pread(td, &oargs)); } +#endif /* * Scatter read system call. @@ -430,6 +432,7 @@ sys_pwrite(td, uap) return(error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_pwrite(td, uap) struct thread *td; @@ -443,6 +446,7 @@ freebsd6_pwrite(td, uap) oargs.offset = uap->offset; return (sys_pwrite(td, &oargs)); } +#endif /* * Gather write system call. diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 09d38d4..9873868 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -342,9 +342,9 @@ int a4); } ; XXX should be { int shmsys(int which, ...); } 172 AUE_NULL UNIMPL nosys -173 AUE_PREAD STD { ssize_t freebsd6_pread(int fd, void *buf, \ +173 AUE_PREAD COMPAT6 { ssize_t pread(int fd, void *buf, \ size_t nbyte, int pad, off_t offset); } -174 AUE_PWRITE STD { ssize_t freebsd6_pwrite(int fd, \ +174 AUE_PWRITE COMPAT6 { ssize_t pwrite(int fd, \ const void *buf, \ size_t nbyte, int pad, off_t offset); } 175 AUE_NULL STD { int setfib(int fibnum); } @@ -376,16 +376,16 @@ __setrlimit_args int 196 AUE_GETDIRENTRIES STD { int getdirentries(int fd, char *buf, \ u_int count, long *basep); } -197 AUE_MMAP STD { caddr_t freebsd6_mmap(caddr_t addr, \ +197 AUE_MMAP COMPAT6 { caddr_t mmap(caddr_t addr, \ size_t len, int prot, int flags, int fd, \ int pad, off_t pos); } 198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ __syscall_args int -199 AUE_LSEEK STD { off_t freebsd6_lseek(int fd, int pad, \ +199 AUE_LSEEK COMPAT6 { off_t lseek(int fd, int pad, \ off_t offset, int whence); } -200 AUE_TRUNCATE STD { int freebsd6_truncate(char *path, int pad, \ +200 AUE_TRUNCATE COMPAT6 { int truncate(char *path, int pad, \ off_t length); } -201 AUE_FTRUNCATE STD { int freebsd6_ftruncate(int fd, int pad, \ +201 AUE_FTRUNCATE COMPAT6 { int ftruncate(int fd, int pad, \ off_t length); } 202 AUE_SYSCTL STD { int __sysctl(int *name, u_int namelen, \ void *old, size_t *oldlenp, void *new, \ diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8c8ca31..c5c479d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1933,6 +1933,7 @@ olseek(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Version with the 'pad' argument */ int freebsd6_lseek(td, uap) @@ -1946,6 +1947,7 @@ freebsd6_lseek(td, uap) ouap.whence = uap->whence; return (sys_lseek(td, &ouap)); } +#endif /* * Check access permissions using passed credentials. @@ -3423,6 +3425,7 @@ otruncate(td, uap) } #endif /* COMPAT_43 */ +#if defined(COMPAT_FREEBSD6) /* Versions with the pad argument */ int freebsd6_truncate(struct thread *td, struct freebsd6_truncate_args *uap) @@ -3443,6 +3446,7 @@ freebsd6_ftruncate(struct thread *td, struct freebsd6_ftruncate_args *uap) ouap.length = uap->length; return (sys_ftruncate(td, &ouap)); } +#endif /* * Sync an open file. diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index a9ff248..02634d6 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -462,6 +462,7 @@ done: return (error); } +#if defined(COMPAT_FREEBSD6) int freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) { @@ -475,6 +476,7 @@ freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) oargs.pos = uap->pos; return (sys_mmap(td, &oargs)); } +#endif #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_ From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 17:10:25 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 622945B2; Fri, 17 Apr 2015 17:10:25 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 41D45EE1; Fri, 17 Apr 2015 17:10:25 +0000 (UTC) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id DE11DA5F; Fri, 17 Apr 2015 10:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1429290622; bh=u/r50BqH2KuLWFZy0vc8nq33V77hnA1fDOpQcFugHAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dMPpaKEw+Nc418K7bK7N1UAX7jas4ZPcmGA9LZomnxp0VVGDT//8szKoNH0ljjPHQ YWidlMtI333fm7r9OnAuWEHkZ4ZDy3GD/RT63ZFlwfPqeIHtYhhex6BT43+NsWaAq6 FLE10jooaGnw+RqMmbiPjGvZJ3U3akw2H1vF3NP0= From: Peter Wemm To: John Baldwin , Oliver Pinter Cc: freebsd-arch@freebsd.org, Stefan Esser , Konstantin Belousov , "freebsd-arch@freebsd.org" Subject: Re: Removal of the 6.x kernel compat code from libc Date: Fri, 17 Apr 2015 10:10:13 -0700 Message-ID: <2754569.tvBmmIXdDx@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <14081053.n6WdaDRXXc@ralph.baldwin.cx> References: <20150417075942.GI2390@kib.kiev.ua> <5531059F.4060500@freebsd.org> <14081053.n6WdaDRXXc@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2048332.VMDmWzcjbt"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 17:10:25 -0000 --nextPart2048332.VMDmWzcjbt Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Friday, April 17, 2015 09:28:24 AM John Baldwin wrote: > On Friday, April 17, 2015 03:07:43 PM Stefan Esser wrote: > > Could we get rid of check_utility_compat(3) on that occasion? > >=20 > > It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of= > > expr(1), which can also be selected with option "-e" and env variab= le > > COMPAT_EXPR. > >=20 > > I doubt that anybody relies on non-POSIX behaviour that has been > > deprecated for some 15 years ... > >=20 > > We'll need to preserve a stub function for check_utility_compat(3),= > > I'm afraid, but I think we can remove the environment variable and > > the actual checking for a sym-link named "/etc/compat-FreeBSD-4-uti= l" > > at startup of expr. (I bet, nobody even knew that the behaviour of > > expr could be changed with above sym-link ...) > >=20 > > If there is consensus, I could prepare a patch to remove the check > > and to update the man-page for expr (just for -CURRENT, no MFC). >=20 > I would not be surprised if Y!BSD depends on this and uses it in 11 F= WIW. :) I'm sorry to say, but yes. We do actually us this on 10.x and 11.x at = work,=20 although it's worse than you can imagine. I just did a quick diff and = I see: =3D=3D=3D=3D //depot/vendor/FreeBSD/stable/10/bin/expr/expr.y#2 (text+k= o) -=20 //depot/yahoo/ybsd_10/src/bin/expr/expr.y#3 (text+ko) =3D=3D=3D=3D cont= ent @@ -270,6 +270,8 @@ int c; =20 setlocale(LC_ALL, ""); + if (getenv("NO_EXPR_COMPAT") =3D=3D NULL) + setenv("EXPR_COMPAT", "1", 1); if (getenv("EXPR_COMPAT") !=3D NULL || check_utility_compat("expr")) { av =3D argv + 1; I'm not going to do an annotate to see who did that.. However, we can=20= maintain patches locally if needed. I'm not even sure *why* its there. I might have removed the code that=20= depended on it. Let me do some research. With a bit of luck, it might= be=20 academic for us now. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart2048332.VMDmWzcjbt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJVMT51AAoJEDXWlwnsgJ4EpKYH/jejxWMydHinWK6Q6cMCoax+ 2o66d0Ugy1NutELJrgXd+JyWaY+ES/TSDrILG+zDiqma4GQS8sTaklfwZlgET12u yW63IbiZWcmYIlczK6Wb2/gXAg4LH6LGxwjDheIWDco0zJFZjijKwdNglX2bH4o6 TsJSCm5UW5tX7ry/nqXfDh/g0ZUcSZ3Z/gpQAN0PHo8+U4e6Vj6zJi2fLZRu2rI5 Fe30mQCS9GFdw57lL/hJcNAhnefe9CVkTbrw0ZDh9Z2MLVWcoP8gk5CIrRIDrSES geyuachUoeBNB9U+H36AyNxj4yiBIaTyyJYHl9y7mXZQ+2L7Tq/XLaetnTZ4+2Q= =nptq -----END PGP SIGNATURE----- --nextPart2048332.VMDmWzcjbt-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 17:25:38 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 459E5863 for ; Fri, 17 Apr 2015 17:25:38 +0000 (UTC) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) (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 16D76E1 for ; Fri, 17 Apr 2015 17:25:37 +0000 (UTC) Received: by pdea3 with SMTP id a3so134326027pde.3 for ; Fri, 17 Apr 2015 10:25:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=YKtclGdlY8wcPftkGypxrxurCB2s9LyVFOxVXdnZLGk=; b=IMDzMY4ZkcsnuCGkiy4hTnd9weM+GlUXYEWdNsc1rFnTM1KIcgsytaoxgywZOzaWGL GdAsnmSHgBxtZArncCEvwz066kWQKNx6bDBRpv3byXTmQaRw3BNfW0Rt7T5E1XxoUtnT waoSrd4GhYoSFB8Ud4nLoZhGWeb2msFjaKx2ajoBTktIwS2HeCVN3dtnFdpr1EK9jpnH v/Cp0s2TAbGL1+3UYYQ0lEJxjj5WtzklGr3MsWM3GV/caIiRANrezJc2neOqsoouU3R8 dEEE85WxMXwAfWzznrCq94TGyVXu2erHijYxZKCaoSYc8Gn/gvh3QG3VxHlZQgLHAayb hdVA== X-Gm-Message-State: ALoCoQlk/a7UCfFFP6ddOqA7oCaFDOCZFuTvDT/4vJxIhMo2qbKYRNvOpPASmPNIPoDA4aLnvY/Y X-Received: by 10.66.217.129 with SMTP id oy1mr7308930pac.82.1429291536805; Fri, 17 Apr 2015 10:25:36 -0700 (PDT) Received: from [10.64.24.57] ([69.53.236.236]) by mx.google.com with ESMTPSA id dp7sm10732763pdb.10.2015.04.17.10.25.34 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 10:25:35 -0700 (PDT) Sender: Warner Losh Subject: Re: Removal of the 6.x kernel compat code from libc Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: multipart/signed; boundary="Apple-Mail=_0E8BBBDD-29F4-4683-9A0C-E6C7B6D00DBC"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b6 From: Warner Losh In-Reply-To: <2754569.tvBmmIXdDx@overcee.wemm.org> Date: Fri, 17 Apr 2015 11:25:32 -0600 Cc: John Baldwin , Oliver Pinter , Konstantin Belousov , "freebsd-arch@freebsd.org" , Stefan Esser , freebsd-arch@freebsd.org Message-Id: References: <20150417075942.GI2390@kib.kiev.ua> <5531059F.4060500@freebsd.org> <14081053.n6WdaDRXXc@ralph.baldwin.cx> <2754569.tvBmmIXdDx@overcee.wemm.org> To: Peter Wemm X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 17:25:38 -0000 --Apple-Mail=_0E8BBBDD-29F4-4683-9A0C-E6C7B6D00DBC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 17, 2015, at 11:10 AM, Peter Wemm wrote: >=20 > On Friday, April 17, 2015 09:28:24 AM John Baldwin wrote: >> On Friday, April 17, 2015 03:07:43 PM Stefan Esser wrote: >>> Could we get rid of check_utility_compat(3) on that occasion? >>>=20 >>> It is only used (AFAIK) to select FreeBSD-4 compatible behaviour of >>> expr(1), which can also be selected with option "-e" and env = variable >>> COMPAT_EXPR. >>>=20 >>> I doubt that anybody relies on non-POSIX behaviour that has been >>> deprecated for some 15 years ... >>>=20 >>> We'll need to preserve a stub function for check_utility_compat(3), >>> I'm afraid, but I think we can remove the environment variable and >>> the actual checking for a sym-link named = "/etc/compat-FreeBSD-4-util" >>> at startup of expr. (I bet, nobody even knew that the behaviour of >>> expr could be changed with above sym-link ...) >>>=20 >>> If there is consensus, I could prepare a patch to remove the check >>> and to update the man-page for expr (just for -CURRENT, no MFC). >>=20 >> I would not be surprised if Y!BSD depends on this and uses it in 11 = FWIW. :) >=20 > I'm sorry to say, but yes. We do actually us this on 10.x and 11.x at = work, > although it's worse than you can imagine. I just did a quick diff and = I see: >=20 > =3D=3D=3D=3D //depot/vendor/FreeBSD/stable/10/bin/expr/expr.y#2 = (text+ko) - > //depot/yahoo/ybsd_10/src/bin/expr/expr.y#3 (text+ko) =3D=3D=3D=3D = content > @@ -270,6 +270,8 @@ > int c; >=20 > setlocale(LC_ALL, ""); > + if (getenv("NO_EXPR_COMPAT") =3D=3D NULL) > + setenv("EXPR_COMPAT", "1", 1); > if (getenv("EXPR_COMPAT") !=3D NULL > || check_utility_compat("expr")) { > av =3D argv + 1; >=20 > I'm not going to do an annotate to see who did that.. However, we can > maintain patches locally if needed. >=20 > I'm not even sure *why* its there. I might have removed the code that > depended on it. Let me do some research. With a bit of luck, it = might be > academic for us now. For some reason, I=E2=80=99m happier you said you were using the expr = hack rather than running new libc on ancient kernels=E2=80=A6 Both fill me with = horror, but I guess the expr one is less horrific somehow... Warner --Apple-Mail=_0E8BBBDD-29F4-4683-9A0C-E6C7B6D00DBC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVMUINAAoJEGwc0Sh9sBEAPFMQAOmK33qnVYMBOfaZd5JTgMjw D/aIEfnXisSFEGnhPQk7hfwYsjbhE+21ExPiHzzD6PRX9J6JGdvlihO0Ax3Zfpx5 Zker1VYIF0KQn9V0lz6jjbDJvYgMQ3OsDBXd5OqlUq8JlYOXMtRGV+qFG4iYY31Q gb8rOVRqkZcUhJdplwryEh+K4feZkyJEIoAIvn0+7l3Ry3o+qUVvoNyL1nxqxM11 CjPkQMao7GMf5YRXOUJWAhqcojlbfNtFl8GSGOHStJIBHSaFnbcJsZ3+z87flXrc bEIj7v20elpVZDmML3QCayKM47KSYbFpyI+J5R4a9m7Up00zunSizxi/RA/X6V9M DCePJMSCCNDAEh9XUyxMpPdG8RA3ASjS7WGFAVdtRGrwvGpH8Y8IslsbSVWZgMep 0Ka8I8oc+2pk7z0OSyxFE2ftEDowsgXkd6WDvwX6oWT7jW//v2awFG/F5MjDw1o7 aX0cK27knQ7V3R07QMW7bzTuSzzhqnSEnYkp0nfVC0bRwCX7WsbYcyYZp3qK81Sl 0Dls0GE1sc0gpNblL8wuLRIphvsw9uubWZI/FOl64sV31Feqry9VxaKkHdmRNSUJ cymJ8+REwpwlE+lnqQnsCNOaqY6w9g0nAvfLlBbQN9Cpk/g75hAkVtQ6eV+aKzN+ drVtbeeFrQnTFvQFW6HW =RpUA -----END PGP SIGNATURE----- --Apple-Mail=_0E8BBBDD-29F4-4683-9A0C-E6C7B6D00DBC-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 20:20:26 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC6DAF1A; Fri, 17 Apr 2015 20:20:25 +0000 (UTC) Received: from mail-pd0-x22f.google.com (mail-pd0-x22f.google.com [IPv6:2607:f8b0:400e:c02::22f]) (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 ACE02849; Fri, 17 Apr 2015 20:20:25 +0000 (UTC) Received: by pdea3 with SMTP id a3so138484155pde.3; Fri, 17 Apr 2015 13:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Ym8QgtL5GIOuGOaoawUEKXcc0egt8RlUTwkYksP2btk=; b=kiTlutxAHST1qmUibmiEaZqpRNQJFXDcwZO8ZfJQdDOrofBf2YJheY3acHVmha3Bm2 EUVnmjgN+V13UxbpWc4R1wufBgJ1gY5BYsYDzAyRFHavavKL8pmyovQTglZJ3TWs+zpv 5fz2xT+WU58tIzCn1siBQ9/Zn6EBeKs3PX/g06Z8NqFVWMYGKdROvaLx4UvfRwnSUi1+ a6wC0ax3PPJHHhs2xu5SMOrigR3xR8UPpjKVV4Etgy/RaP2lV9o9Th3rH4/T85L8vJGZ dXl7AP8P2WFo9Xj2Q7jhu5rZR4WIfqVs4Lduxz6H8dqk31iy0zpV8pA+g+aGjNTuocKT lg5g== X-Received: by 10.70.95.228 with SMTP id dn4mr5311018pdb.89.1429302025203; Fri, 17 Apr 2015 13:20:25 -0700 (PDT) MIME-Version: 1.0 Sender: ycyc321@gmail.com Received: by 10.67.2.42 with HTTP; Fri, 17 Apr 2015 13:19:54 -0700 (PDT) In-Reply-To: <6048769.xVxqkDkTGK@ralph.baldwin.cx> References: <6048769.xVxqkDkTGK@ralph.baldwin.cx> From: Yue Chen Date: Fri, 17 Apr 2015 16:19:54 -0400 X-Google-Sender-Auth: F283DNDIXriyceavx1YIYuCWjgI Message-ID: Subject: Re: Situations about PC values in kernel data segments To: John Baldwin Cc: freebsd-arch@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 20:20:26 -0000 I mean, the PC values in non-.text segments like .data, .rodata, stack, heap, etc. Usually this is for comparison purposes. E.g., compare the faulting PC against some range already stored in a table/handler. > When pcb_onfault is used it is set to point to code in a .text segment, not anywhere else. The pointer value stored in non-.text segments is a PC value (instruction address in .text), like 0xffffffff12345678, and may not be a function entry point address, right? On Fri, Apr 17, 2015 at 9:22 AM, John Baldwin wrote: > On Saturday, April 11, 2015 05:18:28 AM Yue Chen wrote: > > Dear all, > > > > We are working on a project about OS security. > > We wonder in which situations the program counter (PC) value (e.g., the > > value in %RIP on x86_64, i.e, instruction address) could be in kernel > > (module) data segments (including stack, heap, etc.). > > > > Here we mainly care about the address/value that are NOT function entry > > points since there exist a number of function pointers. Also, we only > > consider the normal cases because one can write arbitrary values into a > > variable/pointer. And we mainly consider i386, AMD64 and ARM. > > > > Here are some situations I can think about: > > function/interrupt/exception/syscall return address on stack; switch/case > > jump table target; page fault handler (pcb_onfault on *BSD); restartable > > atomic sequences (RAS) registry; thread/process context structure like > Task > > state segment (TSS), process control block (PCB) and thread control block > > (TCB); situations for debugging purposes (e.g., like those in ``segment > not > > present'' exception handler). > > > > Additionally, does any of these addresses have offset formats or special > > encodings? For example, on x86_64, we may use 32-bit RIP-relative > > (addressing) offset to represent a 64-bit full address. In glibc's > > setjmp/longjmp jmp_buf, they use a special encoding (PTR_MANGLE) for > saved > > register values. > > For i386 and amd64, I think all of the code that is executed does live in a > .text segment. When pcb_onfault is used it is set to point to code in a > .text > segment, not anywhere else. Similarly, fault and exception handlers as > well > as the stub for new threads/processes after fork/thread_create is in .text > as well. There are multiple text segments present when modules are loaded > of course, but you should be able to enumerate all of those in the linker. > > -- > John Baldwin > From owner-freebsd-arch@FreeBSD.ORG Fri Apr 17 22:29:32 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 136766BD for ; Fri, 17 Apr 2015 22:29:32 +0000 (UTC) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CF55587E for ; Fri, 17 Apr 2015 22:29:31 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id E1FB2B80E8; Sat, 18 Apr 2015 00:29:27 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id CB8CD28494; Sat, 18 Apr 2015 00:29:27 +0200 (CEST) Date: Sat, 18 Apr 2015 00:29:27 +0200 From: Jilles Tjoelker To: Konstantin Belousov Cc: arch@freebsd.org Subject: Re: Make ppoll(2) and waitid(2) cancellation points Message-ID: <20150417222927.GB34016@stack.nl> References: <20150417075933.GH2390@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150417075933.GH2390@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 22:29:32 -0000 On Fri, Apr 17, 2015 at 10:59:33AM +0300, Konstantin Belousov wrote: > Patch below makes ppoll(2) and waitid(2) cancellable. > The waitid(2) is required to be a cancellation point by POSIX, so the > change fixes a definite bug. It is done by making wait6() cancellable, > in line with the other wait*(2) syscalls. > For ppoll(2), our other select/poll interfaces are cancel points, i.e. > select, pselect, and poll. It is reasonable for ppoll() to follow the > suite. > The interposing table was extended at the end, instead of ordering new > interposers by alphabet. It would be acceptable, but makes it easier > for people to run new libc with older libthr (although not supported). lib/libc/gen/waitid.c needs to be adjusted to call __libc_interposing[INTERPOS_wait6] instead of _wait6 which is not a cancellation point. Please add comments about cancellation behaviour to lib/libthr/thread/thr_syscalls.c. You can just copy the comments from __thr_poll and __thr_wait4. Looks good otherwise. -- Jilles Tjoelker