Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4108530yba; Tue, 9 Apr 2019 11:18:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+0e5PRXfZl8FmmYivhy1PSdGMHDqqxJnlfsJZ18ZBqLrJeUxAAlntudt9XndITxSnjF+a X-Received: by 2002:a63:c706:: with SMTP id n6mr26705499pgg.310.1554833900236; Tue, 09 Apr 2019 11:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554833900; cv=none; d=google.com; s=arc-20160816; b=YUDoxjjYl2bZ2N/GyTLNhKyd7vjNWHzipNc3mmzBsZc+vuaqHrsHzKPZ/P71z2hCrQ 3Qa2jXgclXEuxBvy0xNhJum8VUARdTdbcAf/esu0WMrbrYmvy/T5DYnLwXdARu75l0uO V9dKT3Cv4vhIf5AN2kNV2ZWXvEhSEFZ6EZMgpXDnElCOrA/fZhuXISVJuX6kpQNOOuIo ILovefvZoKEsEgCnwGc/Dw+CzuN60GrkvckidQhVqL0coGA6E7R2cIJ2PmcAfsmnoEnT xMBmAP7Q64VaKzowaK2DH2AVa3UwdOeuq8uOiLsDzrzKk0aIgYFZeNJT1fpRyJ/+kpAh 57kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization; bh=Ow1HgHPPdi52yTjpAAmrE000eCRLxicuBus2zEThNJA=; b=B1Z0t/UOkt5tDuM1Vc6iaYZybwEoQn6OpsBHnIEGAPLsn9SFH4ah2U9pi/GbGAF9/C PUtGp+EkZdcbpqro2QNtWpvl6B6w5uPj8+g2dYGi6w0Z+Zr1aEraoH/v7EHy7e1C+BWx WaUhWVbIwfnxPhWvwZ0PteVt+NRgw00ibtaDV7BACewAhUlBGjoqLePxLrr5lUcjU/pw EwJpZs23GLBwl0UdN6CCVsJQ66lM+2fFRMNrXwBEirpxFBQ0aa1OtTG+gDpUoWv6N1Y1 yqU5EEBg+DN5+GP8tE6zPbDhv+7B/Pash3fA8ngVn38cx2fGTFWI7f8Ep1PufKc3+Hll 875w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si14968103plg.39.2019.04.09.11.18.03; Tue, 09 Apr 2019 11:18:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbfDISR1 (ORCPT + 99 others); Tue, 9 Apr 2019 14:17:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60778 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbfDISR1 (ORCPT ); Tue, 9 Apr 2019 14:17:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4668E66971; Tue, 9 Apr 2019 18:17:27 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-98.rdu2.redhat.com [10.10.121.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBF33619A2; Tue, 9 Apr 2019 18:17:25 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20190408124640.GA607@lst.de> To: Arnd Bergmann Cc: dhowells@redhat.com, Christoph Hellwig , Jie Zhang , Mike Frysinger , linux-arch , Linux Kernel Mailing List Subject: Re: CONFIG_* symbols in UAPI headers? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3478.1554833845.1@warthog.procyon.org.uk> Date: Tue, 09 Apr 2019 19:17:25 +0100 Message-ID: <3479.1554833845@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 09 Apr 2019 18:17:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann wrote: > > I just stumbled over the MAP_UNINITIALIZED defintion, initially > > added by: > > > > commit ea637639591def87a54cea811cbac796980cb30d > > Author: Jie Zhang > > Date: Mon Dec 14 18:00:02 2009 -0800 > > > > nommu: fix malloc performance by adding uninitialized flag > > > > The defintion depends on CONFIG_MMAP_ALLOW_UNINITIALIZED, which > > will never be set by userspace. How is this supposed to work? > > > > Shoudn't we define the symbol unconditionally and just turn it > > into a no-op in the implementation? Yes. > Right, good catch. That should work. It can probably be done > by adding another check before the conditional, like: > > /* clear anonymous mappings that don't ask for uninitialized data */ > if (!vma->vm_file && > !(IS_ENABLED(CONFIG_MMAP_ALLOW_UNINITIALIZED) && > (flags & MAP_UNINITIALIZED)) > memset((void *)region->vm_start, 0, > region->vm_end - region->vm_start); Sounds good. > > There are a few similar issues, like struct elf_prstatus having > > a different layout depending on CONFIG_BINFMT_ELF_FDPIC, or > > MAX_SHARED_LIBS defending on CONFIG_BINFMT_SHARED_FLAT. Because the kernel code uses that header and that struct too, so you'd break compilation of binfmt_elf_fdpic.c. There is a way round it - and that's to copy the struct into the non-UAPI backing header and delete the conditional section from the UAPI one. You'd have to stop the non-UAPI header from #including the UAPI header, though, and you'd have to hope that no one is trying to set it in userspace (gdb doesn't). David