Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp166352ybm; Thu, 28 May 2020 19:22:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKkKQR4KAcMqgJvJ4b7hDtzS2BgetCAf6vPIXrdHqTFtzl9Z4BX9X4DS5f6y+ussIUHDj3 X-Received: by 2002:a17:906:4a4e:: with SMTP id a14mr913415ejv.545.1590718940852; Thu, 28 May 2020 19:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590718940; cv=none; d=google.com; s=arc-20160816; b=U9CDR1oC3yilpWZzbTBtboS7XjL3ZYaimnUCp4r/5Z7JwyBiozSM3ZpDfmXvPK8mk5 ETLwOOqz77KqS52f+u2NyImdL86lbuxhK0OeEUdZYrbdJ68pXj7vXG/jNiNUGAlvwMjX 56TzGOWdBa2oAG1OEsVA5M/pJTcGsqEP5f0o8BhKY47lZAGUHmbekykPy6WQ7SvB2uT6 rZp7RRuA9kEfEx9B5gNZpSFUor7hLCoN9wFIR7oNQ8y5KyNLDfcjHvwsBkii/MKt7ZaC trrJlEXo8C3RD2X3ip6KSgwgZjouGbr1d66ofrbFyE14TG03Kzxjh1Z4fxqDcdG6zgdX MMvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vJ9gTWfjqaGlpCPsXTDGoSd7Y0WPXEnUn4OlpmNxO6I=; b=SzNxET1s1DnWWY8nLz/0oSlFzbQkfgP6AMHpb1GFNl3AhMp9KhTmhf4zL0HrOdCQyl GR8czmf6kVINwDOxCFbeJxFrX4+b62IqAn7QmyoE4Qok/JEJ7leqE1zprVivFmolpCbZ bOZPfQktRgemd89AB31cm4vyei7o/F0S9bYOtU/Wpie7ntuCi4Dvm6YsHfhIVOenxcAC Im4LqlPkoJiixO29ihkVPDNJu4uLwY5km3RHouSTOp0ZYXnh/d+9wxcodlkHu6ilL6IM 7rUBc21h+ZUD1cFLxgXScrO8Oo/zT242MybEC1T9NgXEI9o+DSX1k1nmDSEIAEkF0aPf jovA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=c+VYr0ZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si4801649ejb.609.2020.05.28.19.21.57; Thu, 28 May 2020 19:22:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=c+VYr0ZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405068AbgE2CSB (ORCPT + 99 others); Thu, 28 May 2020 22:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404420AbgE2CSA (ORCPT ); Thu, 28 May 2020 22:18:00 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8E8C08C5C6 for ; Thu, 28 May 2020 19:17:58 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id v16so638605ljc.8 for ; Thu, 28 May 2020 19:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vJ9gTWfjqaGlpCPsXTDGoSd7Y0WPXEnUn4OlpmNxO6I=; b=c+VYr0ZVdU3iMPGuzHmmoxf6LEmKKBoJczjatsGoUG8CGFdTOy3VWdUN/y2iKgZF6J /PTpay60je5Kj8cZtv20gACm1Qw1CVeZL+zjTZJpv7PmnbYnkLSn6/o3vpYedc/tbmB3 v3vhimV/M/mZn2nQBihFznTL5ciTjwDDfoGww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vJ9gTWfjqaGlpCPsXTDGoSd7Y0WPXEnUn4OlpmNxO6I=; b=WargqSNEtd6uLx6PRXmk/Nyq3H+8LB+CwjTH/lFvAkG42FZ1/6TsJPV6S8hKUvMdmw UDteXTp0tg3BqZ8eEB7ZkaeBkanoSCPuZz1NsqGzVTaRpSBZ27/dNNofx05lV8hv2oB0 XaXvvoDaPMgxnE047AHx76pfT0QM2ZaJEG27jSB4n9meGS1HSWOayo8+3fddtprSz33j 9k+/MLg1ht5VNM52lyxAXduWZeXR1FbW7cUUULyoV3evc/UXAK7+0JnHedwrzNW/QP95 mjhulRf6N6XglnuqTaWFNHqqtSkTeRqNweajvWjkRiyCsbVRoU2FCOpRabeX1vnrbL7b ssYQ== X-Gm-Message-State: AOAM532tnmecyj7DNOWfCaVXFn8xzOJgCIWfHP8KLQoDxcfm9hAv6AUi WszWBnB2LHbEUoff+qE7jZ+H8vpjhzo= X-Received: by 2002:a05:651c:120d:: with SMTP id i13mr2790687lja.381.1590718675992; Thu, 28 May 2020 19:17:55 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id h2sm1984064ljb.45.2020.05.28.19.17.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 19:17:55 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id z18so612091lji.12 for ; Thu, 28 May 2020 19:17:54 -0700 (PDT) X-Received: by 2002:a2e:9f43:: with SMTP id v3mr3141974ljk.285.1590718674086; Thu, 28 May 2020 19:17:54 -0700 (PDT) MIME-Version: 1.0 References: <20200528135552.GA87103@google.com> <20200528230859.GB225299@google.com> <20200529014524.GA38759@google.com> In-Reply-To: <20200529014524.GA38759@google.com> From: Linus Torvalds Date: Thu, 28 May 2020 19:17:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sched/headers: Fix sched_setattr userspace compilation breakage To: Joel Fernandes Cc: Linux Kernel Mailing List , Matthew Blecker , Jesse Barnes , Mike Frysinger , Christian Brauner , vpillai , vineethrp@gmail.com, Peter Zijlstra , stable , Greg Kroah-Hartman , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2020 at 6:45 PM Joel Fernandes wrote: > > glibc's already defines struct sched_param (which is a POSIX > struct), so my inclusion of above which is a UAPI > header exported by the kernel, breaks because the following commit moved > sched_param into the UAPI: > e2d1e2aec572a ("sched/headers: Move various ABI definitions to ") > > Simply reverting that part of the patch also fixes it, like below. Would > that be an acceptable fix? Then I can go patch glibc to get struct > sched_attr by including the UAPI's . Otherwise, I > suspect glibc will also break if it tried to include the UAPI header. Hmm. Reverting that commit makes some sense as a "it broke things", and yes, if this was some recent change that caused problems with user headers, that would be what we should do (at least to then think about it a bit more). But that commit was done three years ago and you're the first person to report breakage. So for all I know, modern glibc source bases have already fixed themselves up, and take advantage of the new UAPI location. Or they just did that kernel header sync many years ago, and will fix it up the next time they do a header sync. So then reverting things (or adding the __KERNEL__ guard) would only break _those_ cases instead and make for only more problems. Basically, I think you should treat this as a glibc header bug, not a kernel header bug. And when you say > The reason is, since did not provide struct sched_attr as the > manpage said, so I did the include of uapi's linux/sched/types.h myself: instead of starting to include the kernel uapi header files - that interact at a deep level with those system header files - you should just treat it as a glibc bug. And then you can either work around it locally, or make a glibc bug-report and hope it gets fixed that way. The "work around it locally" might be something like a "glibc-sched-h-fixup.h" header file that does #ifndef SCHED_FIXUP_H #define SCHED_FIXUP_H #include /* This is documented to come from , but doesn't */ struct sched_attr { __u32 size; __u32 sched_policy; __u64 sched_flags; /* SCHED_NORMAL, SCHED_BATCH */ __s32 sched_nice; /* SCHED_FIFO, SCHED_RR */ __u32 sched_priority; /* SCHED_DEADLINE */ __u64 sched_runtime; __u64 sched_deadline; __u64 sched_period; /* Utilization hints */ __u32 sched_util_min; __u32 sched_util_max; }; #end /* SCHED_FIXUP_H */ in your build environment (possibly with configure magic etc to find the need for this fixup, depending on how fancy you want to be). Because when we have a change that is three+ years old, we can't reasonably change the kernel back again without then likely just breaking some other case that depends on that uapi file that has been there for the last few years. glibc and the kernel aren't developed in sync, so glibc generally takes a snapshot of the kernel headers and then works with that. That allows glibc developers to work around any issues they have with our uapi headers (we've had lots of namespace issues, for example), but it also means that the system headers aren't using some "generic kernel UAPI headers". They are using a very _particular_ set of kernel uapi headers from (likely) several years ago, and quite possibly then further edited too. Which is why you can't then mix glibc system headers that are years old with kernel headers that are modern (or vice versa). Well, with extreme luck and/or care you can. But not in general. Linus