Commit Graph

797392 Commits

Author SHA1 Message Date
Andy Lutomirski
0d9fecb9e1 UPSTREAM: random: delete code to pull data into pools
There is no pool that pulls, so it was just dead code.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/4a05fe0c7a5c831389ef4aea51d24528ac8682c7.1577088521.git.luto@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 84df7cdfbb)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: Ife94608a2f1c11bceafa8490a2c698cdfc104b4c
2020-02-19 14:34:34 -08:00
Andy Lutomirski
450325f09f UPSTREAM: random: remove the blocking pool
There is no longer any interface to read data from the blocking
pool, so remove it.

This enables quite a bit of code deletion, much of which will be
done in subsequent patches.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/511225a224bf0a291149d3c0b8b45393cd03ab96.1577088521.git.luto@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 90ea1c6436)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I0ccca476cfbed9e17ab8c3bec4808adb117b57a7
2020-02-19 14:34:34 -08:00
Andy Lutomirski
b6fbe34c23 UPSTREAM: random: make /dev/random be almost like /dev/urandom
This patch changes the read semantics of /dev/random to be the same
as /dev/urandom except that reads will block until the CRNG is
ready.

None of the cleanups that this enables have been done yet.  As a
result, this gives a warning about an unused function.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/5e6ac8831c6cf2e56a7a4b39616d1732b2bdd06c.1577088521.git.luto@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 30c08efec8)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I40d6f5b535aca178419cb4f7821b4a9105367c51
2020-02-19 14:34:33 -08:00
Andy Lutomirski
56449c8657 UPSTREAM: random: Add a urandom_read_nowait() for random APIs that don't warn
/dev/random and getrandom() never warn.  Split the meat of
urandom_read() into urandom_read_nowarn() and leave the warning code
in urandom_read().

This has no effect on kernel behavior, but it makes subsequent
patches more straightforward.  It also makes the fact that
getrandom() never warns more obvious.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/c87ab200588de746431d9f916501ef11e5242b13.1577088521.git.luto@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit c6f1deb158)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: Iaf34ab88dac9c6a0e217d48543d1d26be32591e5
2020-02-19 14:34:33 -08:00
Andy Lutomirski
433601243f UPSTREAM: random: Don't wake crng_init_wait when crng_init == 1
crng_init_wait is only used to wayt for crng_init to be set to 2, so
there's no point to waking it when crng_init is set to 1.  Remove the
unnecessary wake_up_interruptible() call.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/6fbc0bfcbfc1fa2c76fd574f5b6f552b11be7fde.1577088521.git.luto@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 4c8d062186)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I472e05f72ffce40683aa187aaf0870af39007ac8
2020-02-19 14:34:33 -08:00
Sergey Senozhatsky
4111ca6a8f UPSTREAM: char/random: silence a lockdep splat with printk()
Sergey didn't like the locking order,

uart_port->lock  ->  tty_port->lock

uart_write (uart_port->lock)
  __uart_start
    pl011_start_tx
      pl011_tx_chars
        uart_write_wakeup
          tty_port_tty_wakeup
            tty_port_default
              tty_port_tty_get (tty_port->lock)

but those code is so old, and I have no clue how to de-couple it after
checking other locks in the splat. There is an onging effort to make all
printk() as deferred, so until that happens, workaround it for now as a
short-term fix.

LTP: starting iogen01 (export LTPROOT; rwtest -N iogen01 -i 120s -s
read,write -Da -Dv -n 2 500b:$TMPDIR/doio.f1.$$
1000b:$TMPDIR/doio.f2.$$)
WARNING: possible circular locking dependency detected
------------------------------------------------------
doio/49441 is trying to acquire lock:
ffff008b7cff7290 (&(&zone->lock)->rlock){..-.}, at: rmqueue+0x138/0x2050

but task is already holding lock:
60ff000822352818 (&pool->lock/1){-.-.}, at: start_flush_work+0xd8/0x3f0

  which lock already depends on the new lock.

  the existing dependency chain (in reverse order) is:

  -> #4 (&pool->lock/1){-.-.}:
       lock_acquire+0x320/0x360
       _raw_spin_lock+0x64/0x80
       __queue_work+0x4b4/0xa10
       queue_work_on+0xac/0x11c
       tty_schedule_flip+0x84/0xbc
       tty_flip_buffer_push+0x1c/0x28
       pty_write+0x98/0xd0
       n_tty_write+0x450/0x60c
       tty_write+0x338/0x474
       __vfs_write+0x88/0x214
       vfs_write+0x12c/0x1a4
       redirected_tty_write+0x90/0xdc
       do_loop_readv_writev+0x140/0x180
       do_iter_write+0xe0/0x10c
       vfs_writev+0x134/0x1cc
       do_writev+0xbc/0x130
       __arm64_sys_writev+0x58/0x8c
       el0_svc_handler+0x170/0x240
       el0_sync_handler+0x150/0x250
       el0_sync+0x164/0x180

  -> #3 (&(&port->lock)->rlock){-.-.}:
       lock_acquire+0x320/0x360
       _raw_spin_lock_irqsave+0x7c/0x9c
       tty_port_tty_get+0x24/0x60
       tty_port_default_wakeup+0x1c/0x3c
       tty_port_tty_wakeup+0x34/0x40
       uart_write_wakeup+0x28/0x44
       pl011_tx_chars+0x1b8/0x270
       pl011_start_tx+0x24/0x70
       __uart_start+0x5c/0x68
       uart_write+0x164/0x1c8
       do_output_char+0x33c/0x348
       n_tty_write+0x4bc/0x60c
       tty_write+0x338/0x474
       redirected_tty_write+0xc0/0xdc
       do_loop_readv_writev+0x140/0x180
       do_iter_write+0xe0/0x10c
       vfs_writev+0x134/0x1cc
       do_writev+0xbc/0x130
       __arm64_sys_writev+0x58/0x8c
       el0_svc_handler+0x170/0x240
       el0_sync_handler+0x150/0x250
       el0_sync+0x164/0x180

  -> #2 (&port_lock_key){-.-.}:
       lock_acquire+0x320/0x360
       _raw_spin_lock+0x64/0x80
       pl011_console_write+0xec/0x2cc
       console_unlock+0x794/0x96c
       vprintk_emit+0x260/0x31c
       vprintk_default+0x54/0x7c
       vprintk_func+0x218/0x254
       printk+0x7c/0xa4
       register_console+0x734/0x7b0
       uart_add_one_port+0x734/0x834
       pl011_register_port+0x6c/0xac
       sbsa_uart_probe+0x234/0x2ec
       platform_drv_probe+0xd4/0x124
       really_probe+0x250/0x71c
       driver_probe_device+0xb4/0x200
       __device_attach_driver+0xd8/0x188
       bus_for_each_drv+0xbc/0x110
       __device_attach+0x120/0x220
       device_initial_probe+0x20/0x2c
       bus_probe_device+0x54/0x100
       device_add+0xae8/0xc2c
       platform_device_add+0x278/0x3b8
       platform_device_register_full+0x238/0x2ac
       acpi_create_platform_device+0x2dc/0x3a8
       acpi_bus_attach+0x390/0x3cc
       acpi_bus_attach+0x108/0x3cc
       acpi_bus_attach+0x108/0x3cc
       acpi_bus_attach+0x108/0x3cc
       acpi_bus_scan+0x7c/0xb0
       acpi_scan_init+0xe4/0x304
       acpi_init+0x100/0x114
       do_one_initcall+0x348/0x6a0
       do_initcall_level+0x190/0x1fc
       do_basic_setup+0x34/0x4c
       kernel_init_freeable+0x19c/0x260
       kernel_init+0x18/0x338
       ret_from_fork+0x10/0x18

  -> #1 (console_owner){-...}:
       lock_acquire+0x320/0x360
       console_lock_spinning_enable+0x6c/0x7c
       console_unlock+0x4f8/0x96c
       vprintk_emit+0x260/0x31c
       vprintk_default+0x54/0x7c
       vprintk_func+0x218/0x254
       printk+0x7c/0xa4
       get_random_u64+0x1c4/0x1dc
       shuffle_pick_tail+0x40/0xac
       __free_one_page+0x424/0x710
       free_one_page+0x70/0x120
       __free_pages_ok+0x61c/0xa94
       __free_pages_core+0x1bc/0x294
       memblock_free_pages+0x38/0x48
       __free_pages_memory+0xcc/0xfc
       __free_memory_core+0x70/0x78
       free_low_memory_core_early+0x148/0x18c
       memblock_free_all+0x18/0x54
       mem_init+0xb4/0x17c
       mm_init+0x14/0x38
       start_kernel+0x19c/0x530

  -> #0 (&(&zone->lock)->rlock){..-.}:
       validate_chain+0xf6c/0x2e2c
       __lock_acquire+0x868/0xc2c
       lock_acquire+0x320/0x360
       _raw_spin_lock+0x64/0x80
       rmqueue+0x138/0x2050
       get_page_from_freelist+0x474/0x688
       __alloc_pages_nodemask+0x3b4/0x18dc
       alloc_pages_current+0xd0/0xe0
       alloc_slab_page+0x2b4/0x5e0
       new_slab+0xc8/0x6bc
       ___slab_alloc+0x3b8/0x640
       kmem_cache_alloc+0x4b4/0x588
       __debug_object_init+0x778/0x8b4
       debug_object_init_on_stack+0x40/0x50
       start_flush_work+0x16c/0x3f0
       __flush_work+0xb8/0x124
       flush_work+0x20/0x30
       xlog_cil_force_lsn+0x88/0x204 [xfs]
       xfs_log_force_lsn+0x128/0x1b8 [xfs]
       xfs_file_fsync+0x3c4/0x488 [xfs]
       vfs_fsync_range+0xb0/0xd0
       generic_write_sync+0x80/0xa0 [xfs]
       xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
       xfs_file_write_iter+0x1a0/0x218 [xfs]
       __vfs_write+0x1cc/0x214
       vfs_write+0x12c/0x1a4
       ksys_write+0xb0/0x120
       __arm64_sys_write+0x54/0x88
       el0_svc_handler+0x170/0x240
       el0_sync_handler+0x150/0x250
       el0_sync+0x164/0x180

       other info that might help us debug this:

 Chain exists of:
   &(&zone->lock)->rlock --> &(&port->lock)->rlock --> &pool->lock/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&pool->lock/1);
                               lock(&(&port->lock)->rlock);
                               lock(&pool->lock/1);
  lock(&(&zone->lock)->rlock);

                *** DEADLOCK ***

4 locks held by doio/49441:
 #0: a0ff00886fc27408 (sb_writers#8){.+.+}, at: vfs_write+0x118/0x1a4
 #1: 8fff00080810dfe0 (&xfs_nondir_ilock_class){++++}, at:
xfs_ilock+0x2a8/0x300 [xfs]
 #2: ffff9000129f2390 (rcu_read_lock){....}, at:
rcu_lock_acquire+0x8/0x38
 #3: 60ff000822352818 (&pool->lock/1){-.-.}, at:
start_flush_work+0xd8/0x3f0

               stack backtrace:
CPU: 48 PID: 49441 Comm: doio Tainted: G        W
Hardware name: HPE Apollo 70             /C01_APACHE_MB         , BIOS
L50_5.13_1.11 06/18/2019
Call trace:
 dump_backtrace+0x0/0x248
 show_stack+0x20/0x2c
 dump_stack+0xe8/0x150
 print_circular_bug+0x368/0x380
 check_noncircular+0x28c/0x294
 validate_chain+0xf6c/0x2e2c
 __lock_acquire+0x868/0xc2c
 lock_acquire+0x320/0x360
 _raw_spin_lock+0x64/0x80
 rmqueue+0x138/0x2050
 get_page_from_freelist+0x474/0x688
 __alloc_pages_nodemask+0x3b4/0x18dc
 alloc_pages_current+0xd0/0xe0
 alloc_slab_page+0x2b4/0x5e0
 new_slab+0xc8/0x6bc
 ___slab_alloc+0x3b8/0x640
 kmem_cache_alloc+0x4b4/0x588
 __debug_object_init+0x778/0x8b4
 debug_object_init_on_stack+0x40/0x50
 start_flush_work+0x16c/0x3f0
 __flush_work+0xb8/0x124
 flush_work+0x20/0x30
 xlog_cil_force_lsn+0x88/0x204 [xfs]
 xfs_log_force_lsn+0x128/0x1b8 [xfs]
 xfs_file_fsync+0x3c4/0x488 [xfs]
 vfs_fsync_range+0xb0/0xd0
 generic_write_sync+0x80/0xa0 [xfs]
 xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
 xfs_file_write_iter+0x1a0/0x218 [xfs]
 __vfs_write+0x1cc/0x214
 vfs_write+0x12c/0x1a4
 ksys_write+0xb0/0x120
 __arm64_sys_write+0x54/0x88
 el0_svc_handler+0x170/0x240
 el0_sync_handler+0x150/0x250
 el0_sync+0x164/0x180

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Qian Cai <cai@lca.pw>
Link: https://lore.kernel.org/r/1573679785-21068-1-git-send-email-cai@lca.pw
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 1b710b1b10)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I26b3dad2eb76ed1d4e0efa1c40299070c0e649ad
2020-02-19 14:34:33 -08:00
Hsin-Yi Wang
cfbb70381f BACKPORT: fdt: add support for rng-seed
Introducing a chosen node, rng-seed, which is an entropy that can be
passed to kernel called very early to increase initial device
randomness. Bootloader should provide this entropy and the value is
read from /chosen/rng-seed in DT.

Obtain of_fdt_crc32 for CRC check after early_init_dt_scan_nodes(),
since early_init_dt_scan_chosen() would modify fdt to erase rng-seed.

Add a new interface add_bootloader_randomness() for rng-seed use case.
Depends on whether the seed is trustworthy, rng seed would be passed to
add_hwgenerator_randomness(). Otherwise it would be passed to
add_device_randomness(). Decision is controlled by kernel config
RANDOM_TRUST_BOOTLOADER.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Theodore Ts'o <tytso@mit.edu> # drivers/char/random.c
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 428826f535)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I54fb81eb88b955ead400fd39180c0fa41de37c8e
2020-02-19 14:34:33 -08:00
Hsin-Yi Wang
b4207eb5fb BACKPORT: arm64: map FDT as RW for early_init_dt_scan()
Currently in arm64, FDT is mapped to RO before it's passed to
early_init_dt_scan(). However, there might be some codes
(eg. commit "fdt: add support for rng-seed") that need to modify FDT
during init. Map FDT to RO after early fixups are done.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit e112b032a7)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I578edbb824fd5aaaf72af5cdb75abaa3b98e6ddd
2020-02-19 14:34:33 -08:00
Theodore Ts'o
2296cc95a3 UPSTREAM: random: fix soft lockup when trying to read from an uninitialized blocking pool
Fixes: eb9d1bf079: "random: only read from /dev/random after its pool has received 128 bits"
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 58be0106c5)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I87df025423848df2e8ff2ccb6856da073a385750
2020-02-19 14:34:33 -08:00
George Spelvin
4a22275376 UPSTREAM: random: document get_random_int() family
Explain what these functions are for and when they offer
an advantage over get_random_bytes().

(We still need documentation on rng_is_initialized(), the
random_ready_callback system, and early boot in general.)

Signed-off-by: George Spelvin <lkml@sdf.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 92e507d216)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I8a218b2569a10ec1106ad04eebccbf26fd7e1ca3
2020-02-19 14:34:33 -08:00
Kees Cook
4ca103e6fa UPSTREAM: random: move rand_initialize() earlier
Right now rand_initialize() is run as an early_initcall(), but it only
depends on timekeeping_init() (for mixing ktime_get_real() into the
pools). However, the call to boot_init_stack_canary() for stack canary
initialization runs earlier, which triggers a warning at boot:

random: get_random_bytes called from start_kernel+0x357/0x548 with crng_init=0

Instead, this moves rand_initialize() to after timekeeping_init(), and moves
canary initialization here as well.

Note that this warning may still remain for machines that do not have
UEFI RNG support (which initializes the RNG pools during setup_arch()),
or for x86 machines without RDRAND (or booting without "random.trust=on"
or CONFIG_RANDOM_TRUST_CPU=y).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit d55535232c)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: If2aec7b464244ae89bdcd0ce2c363c36645aaa6c
2020-02-19 14:34:33 -08:00
Theodore Ts'o
94bf375691 UPSTREAM: random: only read from /dev/random after its pool has received 128 bits
Immediately after boot, we allow reads from /dev/random before its
entropy pool has been fully initialized.  Fix this so that we don't
allow this until the blocking pool has received 128 bits.

We do this by repurposing the initialized flag in the entropy pool
struct, and use the initialized flag in the blocking pool to indicate
whether it is safe to pull from the blocking pool.

To do this, we needed to rework when we decide to push entropy from the
input pool to the blocking pool, since the initialized flag for the
input pool was used for this purpose.  To simplify things, we no
longer use the initialized flag for that purpose, nor do we use the
entropy_total field any more.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit eb9d1bf079)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: Ic0f66f7f04b514446cdec4cab4a47a0d3a184886
2020-02-19 14:34:33 -08:00
Rasmus Villemoes
e7e09e4f9e UPSTREAM: drivers/char/random.c: make primary_crng static
Since the definition of struct crng_state is private to random.c, and
primary_crng is neither declared or used elsewhere, there's no reason
for that symbol to have external linkage.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 764ed189c8)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I717cda431b78bb99f3339461b6868308dd31cf12
2020-02-19 14:34:33 -08:00
Rasmus Villemoes
53a9c08400 UPSTREAM: drivers/char/random.c: remove unused stuct poolinfo::poolbits
This field is never used, might as well remove it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 3bd0b5bf7d)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I29de002717f8b600adb741e469fada15a9c0d25c
2020-02-19 14:34:33 -08:00
Rasmus Villemoes
2bfadb401b UPSTREAM: drivers/char/random.c: constify poolinfo_table
Never modified, might as well be put in .rodata.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 26e0854ab3)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 148665638
Change-Id: I764d96db977cdf1a6a890897033999793dc53848
2020-02-19 14:34:33 -08:00
Alistair Delva
6617bf0e6d ANDROID: clang: update to 10.0.4
Bug: 149785865
Change-Id: I953557b4fab528ee9528312c3364e8ec36a16f85
Signed-off-by: Alistair Delva <adelva@google.com>
2020-02-19 19:33:36 +00:00
Matthias Maennich
c111b47b50 ANDROID: Fix ABI representation after enabling CONFIG_NET_NS
Leaf changes summary: 4 artifacts changed (1 filtered out)
Changed leaf types summary: 4 (1 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

'struct net_device at netdevice.h:1747:1' changed:
  type size hasn't changed
  there are data member changes:
   'possible_net_t net_device::nd_net' size changed from 0 to 64 (in bits) (by +64 bits)
   offset changed from 9472 to 9536 (in bits) (by +64 bits)
   'device net_device::dev' offset changed from 9536 to 9600 (in bits) (by +64 bits)
   'const attribute_group* net_device::sysfs_groups[4]' offset changed from 15744 to 15808 (in bits) (by +64 bits)
   'const attribute_group* net_device::sysfs_rx_queue_group' offset changed from 16000 to 16064 (in bits) (by +64 bits)
   'const rtnl_link_ops* net_device::rtnl_link_ops' offset changed from 16064 to 16128 (in bits) (by +64 bits)
   'unsigned int net_device::gso_max_size' offset changed from 16128 to 16192 (in bits) (by +64 bits)
   'u16 net_device::gso_max_segs' offset changed from 16160 to 16224 (in bits) (by +64 bits)
   's16 net_device::num_tc' offset changed from 16176 to 16240 (in bits) (by +64 bits)
   'netdev_tc_txq net_device::tc_to_txq[16]' offset changed from 16192 to 16256 (in bits) (by +64 bits)
   'u8 net_device::prio_tc_map[16]' offset changed from 16704 to 16768 (in bits) (by +64 bits)
   'phy_device* net_device::phydev' offset changed from 16832 to 16896 (in bits) (by +64 bits)
   'sfp_bus* net_device::sfp_bus' offset changed from 16896 to 16960 (in bits) (by +64 bits)
   'lock_class_key* net_device::qdisc_tx_busylock' offset changed from 16960 to 17024 (in bits) (by +64 bits)
   'lock_class_key* net_device::qdisc_running_key' offset changed from 17024 to 17088 (in bits) (by +64 bits)
   'bool net_device::proto_down' offset changed from 17088 to 17152 (in bits) (by +64 bits)

  95 impacted interfaces

'struct request_sock at request_sock.h:50:1' changed:
  type size changed from 1728 to 1792 (in bits)
  there are data member changes:
   type 'struct sock_common' of 'request_sock::__req_common' changed:
, size changed from 1024 to 1088 (in bits) (by +64 bits)
   'request_sock* request_sock::dl_next' offset changed from 1024 to 1088 (in bits) (by +64 bits)
   'u16 request_sock::mss' offset changed from 1088 to 1152 (in bits) (by +64 bits)
   'u8 request_sock::num_retrans' offset changed from 1104 to 1168 (in bits) (by +64 bits)
   'u8 request_sock::num_timeout' offset changed from 1112 to 1176 (in bits) (by +64 bits)
   'u32 request_sock::ts_recent' offset changed from 1120 to 1184 (in bits) (by +64 bits)
   'timer_list request_sock::rsk_timer' offset changed from 1152 to 1216 (in bits) (by +64 bits)
   'const request_sock_ops* request_sock::rsk_ops' offset changed from 1472 to 1536 (in bits) (by +64 bits)
   'sock* request_sock::sk' offset changed from 1536 to 1600 (in bits) (by +64 bits)
   'u32* request_sock::saved_syn' offset changed from 1600 to 1664 (in bits) (by +64 bits)
   'u32 request_sock::secid' offset changed from 1664 to 1728 (in bits) (by +64 bits)
   'u32 request_sock::peer_secid' offset changed from 1696 to 1760 (in bits) (by +64 bits)

  29 impacted interfaces

'struct sock at sock.h:327:1' changed:
  type size changed from 5696 to 5760 (in bits)
  there are data member changes:
   type 'struct sock_common' of 'sock::__sk_common' changed:
     type size changed from 1024 to 1088 (in bits)
     there are data member changes:
      'possible_net_t sock_common::skc_net' size changed from 0 to 64 (in bits) (by +64 bits)
      'in6_addr sock_common::skc_v6_daddr' offset changed from 384 to 448 (in bits) (by +64 bits)
      'in6_addr sock_common::skc_v6_rcv_saddr' offset changed from 512 to 576 (in bits) (by +64 bits)
      'atomic64_t sock_common::skc_cookie' offset changed from 640 to 704 (in bits) (by +64 bits)
      'int sock_common::skc_dontcopy_begin[]' offset changed from 768 to 832 (in bits) (by +64 bits)
      'unsigned short int sock_common::skc_tx_queue_mapping' offset changed from 896 to 960 (in bits) (by +64 bits)
      'unsigned short int sock_common::skc_rx_queue_mapping' offset changed from 912 to 976 (in bits) (by +64 bits)
      'refcount_t sock_common::skc_refcnt' offset changed from 960 to 1024 (in bits) (by +64 bits)
      'int sock_common::skc_dontcopy_end[]' offset changed from 992 to 1056 (in bits) (by +64 bits)

     29 impacted interfaces
, offset changed from 1728 to 1792 (in bits) (by +64 bits)
   'int sock::sk_forward_alloc' offset changed from 1920 to 1984 (in bits) (by +64 bits)
   'unsigned int sock::sk_ll_usec' offset changed from 1952 to 2016 (in bits) (by +64 bits)
   'unsigned int sock::sk_napi_id' offset changed from 1984 to 2048 (in bits) (by +64 bits)
   'int sock::sk_rcvbuf' offset changed from 2016 to 2080 (in bits) (by +64 bits)
   'sk_filter* sock::sk_filter' offset changed from 2048 to 2112 (in bits) (by +64 bits)
   offset changed from 2112 to 2176 (in bits) (by +64 bits)
   'xfrm_policy* sock::sk_policy[2]' offset changed from 2176 to 2240 (in bits) (by +64 bits)
   'dst_entry* sock::sk_rx_dst' offset changed from 2304 to 2368 (in bits) (by +64 bits)
   'dst_entry* sock::sk_dst_cache' offset changed from 2368 to 2432 (in bits) (by +64 bits)
   'atomic_t sock::sk_omem_alloc' offset changed from 2432 to 2496 (in bits) (by +64 bits)
   'int sock::sk_sndbuf' offset changed from 2464 to 2528 (in bits) (by +64 bits)
   'int sock::sk_wmem_queued' offset changed from 2496 to 2560 (in bits) (by +64 bits)
   'refcount_t sock::sk_wmem_alloc' offset changed from 2528 to 2592 (in bits) (by +64 bits)
   'unsigned long int sock::sk_tsq_flags' offset changed from 2560 to 2624 (in bits) (by +64 bits)
   'sk_buff_head sock::sk_write_queue' offset changed from 2688 to 2752 (in bits) (by +64 bits)
   '__s32 sock::sk_peek_off' offset changed from 2880 to 2944 (in bits) (by +64 bits)
   'int sock::sk_write_pending' offset changed from 2912 to 2976 (in bits) (by +64 bits)
   '__u32 sock::sk_dst_pending_confirm' offset changed from 2944 to 3008 (in bits) (by +64 bits)
   'u32 sock::sk_pacing_status' offset changed from 2976 to 3040 (in bits) (by +64 bits)
   'long int sock::sk_sndtimeo' offset changed from 3008 to 3072 (in bits) (by +64 bits)
   'timer_list sock::sk_timer' offset changed from 3072 to 3136 (in bits) (by +64 bits)
   '__u32 sock::sk_priority' offset changed from 3392 to 3456 (in bits) (by +64 bits)
   '__u32 sock::sk_mark' offset changed from 3424 to 3488 (in bits) (by +64 bits)
   'u32 sock::sk_pacing_rate' offset changed from 3456 to 3520 (in bits) (by +64 bits)
   'u32 sock::sk_max_pacing_rate' offset changed from 3488 to 3552 (in bits) (by +64 bits)
   'page_frag sock::sk_frag' offset changed from 3520 to 3584 (in bits) (by +64 bits)
   'netdev_features_t sock::sk_route_caps' offset changed from 3648 to 3712 (in bits) (by +64 bits)
   'netdev_features_t sock::sk_route_nocaps' offset changed from 3712 to 3776 (in bits) (by +64 bits)
   'netdev_features_t sock::sk_route_forced_caps' offset changed from 3776 to 3840 (in bits) (by +64 bits)
   'int sock::sk_gso_type' offset changed from 3840 to 3904 (in bits) (by +64 bits)
   'unsigned int sock::sk_gso_max_size' offset changed from 3872 to 3936 (in bits) (by +64 bits)
   'gfp_t sock::sk_allocation' offset changed from 3904 to 3968 (in bits) (by +64 bits)
   '__u32 sock::sk_txhash' offset changed from 3936 to 4000 (in bits) (by +64 bits)
   'unsigned int sock::__sk_flags_offset[]' offset changed from 3968 to 4032 (in bits) (by +64 bits)
   'unsigned int sock::sk_type' offset changed from 3968 to 4032 (in bits) (by +64 bits)
   'u16 sock::sk_gso_max_segs' offset changed from 4000 to 4064 (in bits) (by +64 bits)
   'u8 sock::sk_pacing_shift' offset changed from 4016 to 4080 (in bits) (by +64 bits)
   'unsigned long int sock::sk_lingertime' offset changed from 4032 to 4096 (in bits) (by +64 bits)
   'proto* sock::sk_prot_creator' offset changed from 4096 to 4160 (in bits) (by +64 bits)
   'rwlock_t sock::sk_callback_lock' offset changed from 4160 to 4224 (in bits) (by +64 bits)
   'int sock::sk_err' offset changed from 4224 to 4288 (in bits) (by +64 bits)
   'int sock::sk_err_soft' offset changed from 4256 to 4320 (in bits) (by +64 bits)
   'u32 sock::sk_ack_backlog' offset changed from 4288 to 4352 (in bits) (by +64 bits)
   'u32 sock::sk_max_ack_backlog' offset changed from 4320 to 4384 (in bits) (by +64 bits)
   'kuid_t sock::sk_uid' offset changed from 4352 to 4416 (in bits) (by +64 bits)
   'pid* sock::sk_peer_pid' offset changed from 4416 to 4480 (in bits) (by +64 bits)
   'const cred* sock::sk_peer_cred' offset changed from 4480 to 4544 (in bits) (by +64 bits)
   'long int sock::sk_rcvtimeo' offset changed from 4544 to 4608 (in bits) (by +64 bits)
   'ktime_t sock::sk_stamp' offset changed from 4608 to 4672 (in bits) (by +64 bits)
   'u16 sock::sk_tsflags' offset changed from 4672 to 4736 (in bits) (by +64 bits)
   'u8 sock::sk_shutdown' offset changed from 4688 to 4752 (in bits) (by +64 bits)
   'u32 sock::sk_tskey' offset changed from 4704 to 4768 (in bits) (by +64 bits)
   'atomic_t sock::sk_zckey' offset changed from 4736 to 4800 (in bits) (by +64 bits)
   'u8 sock::sk_clockid' offset changed from 4768 to 4832 (in bits) (by +64 bits)
   'u8 sock::sk_txtime_unused' offset changed from 4776 to 4840 (in bits) (by +64 bits)
   'socket* sock::sk_socket' offset changed from 4800 to 4864 (in bits) (by +64 bits)
   'void* sock::sk_user_data' offset changed from 4864 to 4928 (in bits) (by +64 bits)
   'void* sock::sk_security' offset changed from 4928 to 4992 (in bits) (by +64 bits)
   'sock_cgroup_data sock::sk_cgrp_data' offset changed from 4992 to 5056 (in bits) (by +64 bits)
   'mem_cgroup* sock::sk_memcg' offset changed from 5056 to 5120 (in bits) (by +64 bits)
   'void ()* sock::sk_state_change' offset changed from 5120 to 5184 (in bits) (by +64 bits)
   'void ()* sock::sk_data_ready' offset changed from 5184 to 5248 (in bits) (by +64 bits)
   'void ()* sock::sk_write_space' offset changed from 5248 to 5312 (in bits) (by +64 bits)
   'void ()* sock::sk_error_report' offset changed from 5312 to 5376 (in bits) (by +64 bits)
   'void ()* sock::sk_backlog_rcv' offset changed from 5376 to 5440 (in bits) (by +64 bits)
   'void ()* sock::sk_destruct' offset changed from 5440 to 5504 (in bits) (by +64 bits)
   'sock_reuseport* sock::sk_reuseport_cb' offset changed from 5504 to 5568 (in bits) (by +64 bits)
   'callback_head sock::sk_rcu' offset changed from 5568 to 5632 (in bits) (by +64 bits)

  29 impacted interfaces

'struct sock_common at sock.h:152:1' changed:
  details were reported earlier

Fixes: c05bf9c3e6 ("ANDROID: gki_defconfig: Enable CONFIG_NET_NS")
Change-Id: Ib996c420fdd2b347c5ea65309543721a174fdc9c
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-02-19 18:11:47 +00:00
Alistair Delva
c05bf9c3e6 ANDROID: gki_defconfig: Enable CONFIG_NET_NS
Bug: 144061615
Bug: 147493341
Change-Id: I6392a7ee9c8ab26ca3e033889d8311661e6ec4aa
Signed-off-by: Alistair Delva <adelva@google.com>
2020-02-19 18:05:12 +00:00
Alistair Delva
5174266903 ANDROID: gki_defconfig: Enable XDP_SOCKETS
Bug: 145685190
Bug: 144061615
Change-Id: I8f2fdf61473916e5e8dbb15e12d49cb0777cb42e
Signed-off-by: Alistair Delva <adelva@google.com>
2020-02-19 18:04:54 +00:00
Quentin Perret
2a557de670 UPSTREAM: sched/topology: Introduce a sysctl for Energy Aware Scheduling
In its current state, Energy Aware Scheduling (EAS) starts automatically
on asymmetric platforms having an Energy Model (EM). However, there are
users who want to have an EM (for thermal management for example), but
don't want EAS with it.

In order to let users disable EAS explicitly, introduce a new sysctl
called 'sched_energy_aware'. It is enabled by default so that EAS can
start automatically on platforms where it makes sense. Flipping it to 0
rebuilds the scheduling domains and disables EAS.

Bug: 120440300
Signed-off-by: Quentin Perret <quentin.perret@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: adharmap@codeaurora.org
Cc: chris.redpath@arm.com
Cc: currojerez@riseup.net
Cc: dietmar.eggemann@arm.com
Cc: edubezval@gmail.com
Cc: gregkh@linuxfoundation.org
Cc: javi.merino@kernel.org
Cc: joel@joelfernandes.org
Cc: juri.lelli@redhat.com
Cc: morten.rasmussen@arm.com
Cc: patrick.bellasi@arm.com
Cc: pkondeti@codeaurora.org
Cc: rjw@rjwysocki.net
Cc: skannan@codeaurora.org
Cc: smuckle@google.com
Cc: srinivas.pandruvada@linux.intel.com
Cc: thara.gopinath@linaro.org
Cc: tkjos@google.com
Cc: valentin.schneider@arm.com
Cc: vincent.guittot@linaro.org
Cc: viresh.kumar@linaro.org
Link: https://lkml.kernel.org/r/20181203095628.11858-11-quentin.perret@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 8d5d0cfb63)
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I4ca842d07b82869cfab7542c8c4351f631e1024d
2020-02-19 10:50:59 +00:00
Greg Kroah-Hartman
4eee97caec Merge 4.19.104 into android-4.19
Changes in 4.19.104
	ASoC: pcm: update FE/BE trigger order based on the command
	hv_sock: Remove the accept port restriction
	IB/mlx4: Fix memory leak in add_gid error flow
	RDMA/netlink: Do not always generate an ACK for some netlink operations
	RDMA/core: Fix locking in ib_uverbs_event_read
	RDMA/uverbs: Verify MR access flags
	scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails
	PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
	ath10k: pci: Only dump ATH10K_MEM_REGION_TYPE_IOREG when safe
	PCI/switchtec: Fix vep_vector_number ioread width
	PCI: Don't disable bridge BARs when assigning bus resources
	nfs: NFS_SWAP should depend on SWAP
	NFS: Revalidate the file size on a fatal write error
	NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes()
	NFSv4: try lease recovery on NFS4ERR_EXPIRED
	serial: uartps: Add a timeout to the tx empty wait
	gpio: zynq: Report gpio direction at boot
	spi: spi-mem: Add extra sanity checks on the op param
	spi: spi-mem: Fix inverted logic in op sanity check
	rtc: hym8563: Return -EINVAL if the time is known to be invalid
	rtc: cmos: Stop using shared IRQ
	ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
	platform/x86: intel_mid_powerbtn: Take a copy of ddata
	ARM: dts: at91: Reenable UART TX pull-ups
	ARM: dts: am43xx: add support for clkout1 clock
	ARM: dts: at91: sama5d3: fix maximum peripheral clock rates
	ARM: dts: at91: sama5d3: define clock rate range for tcb1
	tools/power/acpi: fix compilation error
	powerpc/pseries/vio: Fix iommu_table use-after-free refcount warning
	powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW
	iommu/arm-smmu-v3: Populate VMID field for CMDQ_OP_TLBI_NH_VA
	KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections
	ARM: 8949/1: mm: mark free_memmap as __init
	arm64: cpufeature: Fix the type of no FP/SIMD capability
	arm64: ptrace: nofpsimd: Fail FP/SIMD regset operations
	KVM: arm/arm64: Fix young bit from mmu notifier
	KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests
	KVM: arm: Make inject_abt32() inject an external abort instead
	KVM: arm64: pmu: Don't increment SW_INCR if PMCR.E is unset
	mtd: onenand_base: Adjust indentation in onenand_read_ops_nolock
	mtd: sharpslpart: Fix unsigned comparison to zero
	crypto: artpec6 - return correct error code for failed setkey()
	crypto: atmel-sha - fix error handling when setting hmac key
	media: i2c: adv748x: Fix unsafe macros
	pinctrl: sh-pfc: r8a7778: Fix duplicate SDSELF_B and SD1_CLK_B
	mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
	mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
	libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held
	libertas: make lbs_ibss_join_existing() return error code on rates overflow
	scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state
	x86/stackframe: Move ENCODE_FRAME_POINTER to asm/frame.h
	x86/stackframe, x86/ftrace: Add pt_regs frame annotations
	serial: uartps: Move the spinlock after the read of the tx empty
	padata: fix null pointer deref of pd->pinst
	Linux 4.19.104

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I42a465b140183dcc8cf49e19903d0e8f4b688930
2020-02-19 08:31:05 +01:00
Alistair Delva
280cae2765 ANDROID: gki_defconfig: Enable MAC80211_RC_MINSTREL
This feature was noticed missing on the android emulator, but it's
normally default 'on', we just were able to disable it because we
turn CONFIG_EXPERT on too.

Bug: 147493341
Change-Id: Ia81b4f841a5b5d4a37ad8a1f3450dff70abc341d
Signed-off-by: Alistair Delva <adelva@google.com>
2020-02-19 04:24:14 +00:00
Jaegeuk Kim
b4d7e099dc ANDROID: f2fs: remove unused function
This was added when merging LTS.

Fixes: 44b82a3d1b ("Merge 4.19.85 into android-4.19")
Change-Id: Ic3ef52ec8f092f6a0e83ddb40ed57f1fa305b21c
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-02-19 03:08:01 +00:00
Roman Kiryanov
369759bf55 ANDROID: virtio: virtio_input: pass _DIRECT only if the device
advertises _DIRECT

INPUT_MT_DIRECT should be used only if the device advertises
INPUT_PROP_DIRECT.

Bug: 147493341
Bug: 149250379
Test: boot emulator with 5.4 kernel, check if touchscreen works
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Ic06ae2b9d0ab7c77cb8829e5392fd048139500a2
2020-02-18 23:50:41 +00:00
Ram Muthiah
9c18171502 ANDROID: cf build: Use merge_configs
Previously the cuttlefish build was cat'ng the cuttlefish.fragment
with the gki_defconfig. The correct way to merge fragments is to use
the merge_configs script.

Bug: 139431025
Bug: 148247383
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I0a62e6c5395b6933955894c8d5ad0484f5c7102d
2020-02-18 21:19:23 +00:00
Lorenzo Colitti
6e04d94ab7 ANDROID: net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
This enables ebpf tethering offload from a cellular interface with
no L2 mac header to a wifi/ethernet/usb interface with one.

Will pursue upstreaming this along with further mtu related fixups.

Test: builds, real testing with identical patch on a 4.14 flame device
Bug: 149724482
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic182320bf1abb248d0f86fa2973c60208710f664
2020-02-18 09:26:17 +00:00
Alistair Delva
823487844c ANDROID: gki_defconfig: Disable SDCARD_FS
Move SDCARD_FS into the fragments for cuttlefish and db845c as this
feature is still being used by AOSP master. These will be removed later.

Bug: 149410031
Change-Id: I9142338cd0709aa8ec067b9e7d8c22390630de02
Signed-off-by: Alistair Delva <adelva@google.com>
2020-02-14 21:40:44 +00:00
Greg Kroah-Hartman
9b15f7fae6 Linux 4.19.104 2020-02-14 16:33:28 -05:00
Daniel Jordan
cad926f70b padata: fix null pointer deref of pd->pinst
The 4.19 backport dc34710a7a ("padata: Remove broken queue flushing")
removed padata_alloc_pd()'s assignment to pd->pinst, resulting in:

    Unable to handle kernel NULL pointer dereference ...
    ...
    pc : padata_reorder+0x144/0x2e0
    ...
    Call trace:
     padata_reorder+0x144/0x2e0
     padata_do_serial+0xc8/0x128
     pcrypt_aead_enc+0x60/0x70 [pcrypt]
     padata_parallel_worker+0xd8/0x138
     process_one_work+0x1bc/0x4b8
     worker_thread+0x164/0x580
     kthread+0x134/0x138
     ret_from_fork+0x10/0x18

This happened because the backport was based on an enhancement that
moved this assignment but isn't in 4.19:

  bfde23ce20 ("padata: unbind parallel jobs from specific CPUs")

Simply restore the assignment to fix the crash.

Fixes: dc34710a7a ("padata: Remove broken queue flushing")
Reported-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:28 -05:00
Shubhrajyoti Datta
77bad0ab1b serial: uartps: Move the spinlock after the read of the tx empty
commit 107475685a upstream.

Currently we are doing a read of the status register.
Move the spinlock after that as the reads need not be spinlock
protected. This patch prevents relaxing the cpu with spinlock held.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Pavel Machek <pavel@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:28 -05:00
Peter Zijlstra
2cdef3b47a x86/stackframe, x86/ftrace: Add pt_regs frame annotations
commit ea1ed38dba upstream.

When CONFIG_FRAME_POINTER, we should mark pt_regs frames.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[4.19 backport; added user-visible changelog]
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:28 -05:00
Peter Zijlstra
510cd44619 x86/stackframe: Move ENCODE_FRAME_POINTER to asm/frame.h
commit a9b3c6998d upstream.

In preparation for wider use, move the ENCODE_FRAME_POINTER macros to
a common header and provide inline asm versions.

These macros are used to encode a pt_regs frame for the unwinder; see
unwind_frame.c:decode_frame_pointer().

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:28 -05:00
Anand Lodnoor
1cb14cce72 scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state
commit 6d7537270e upstream.

Driver initiates OCR if a DCMD command times out. But there is a deadlock
if the driver attempts to invoke another OCR before the mutex lock
(reset_mutex) is released from the previous session of OCR.

This patch takes care of the above scenario using new flag
MEGASAS_FUSION_OCR_NOT_POSSIBLE to indicate if OCR is possible.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1579000882-20246-9-git-send-email-anand.lodnoor@broadcom.com
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Anand Lodnoor <anand.lodnoor@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:28 -05:00
Nicolai Stange
1de085c83f libertas: make lbs_ibss_join_existing() return error code on rates overflow
[ Upstream commit 1754c4f60a ]

Commit e5e884b426 ("libertas: Fix two buffer overflows at parsing bss
descriptor") introduced a bounds check on the number of supplied rates to
lbs_ibss_join_existing() and made it to return on overflow.

However, the aforementioned commit doesn't set the return value accordingly
and thus, lbs_ibss_join_existing() would return with zero even though it
failed.

Make lbs_ibss_join_existing return -EINVAL in case the bounds check on the
number of supplied rates fails.

Fixes: e5e884b426 ("libertas: Fix two buffer overflows at parsing bss descriptor")
Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:33:27 -05:00
Nicolai Stange
8ffeb2114d libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held
[ Upstream commit c7bf1fb7dd ]

Commit e5e884b426 ("libertas: Fix two buffer overflows at parsing bss
descriptor") introduced a bounds check on the number of supplied rates to
lbs_ibss_join_existing().

Unfortunately, it introduced a return path from within a RCU read side
critical section without a corresponding rcu_read_unlock(). Fix this.

Fixes: e5e884b426 ("libertas: Fix two buffer overflows at parsing bss descriptor")
Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:33:27 -05:00
Qing Xu
48247f7e14 mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
[ Upstream commit b70261a288 ]

mwifiex_cmd_append_vsie_tlv() calls memcpy() without checking
the destination size may trigger a buffer overflower,
which a local user could use to cause denial of service
or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Qing Xu <m1s5p6688@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:33:27 -05:00
Qing Xu
fab5ca7996 mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
[ Upstream commit 3a9b153c55 ]

mwifiex_ret_wmm_get_status() calls memcpy() without checking the
destination size.Since the source is given from remote AP which
contains illegal wmm elements , this may trigger a heap buffer
overflow.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Qing Xu <m1s5p6688@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:33:27 -05:00
Geert Uytterhoeven
920d65a772 pinctrl: sh-pfc: r8a7778: Fix duplicate SDSELF_B and SD1_CLK_B
commit 805f635703 upstream.

The FN_SDSELF_B and FN_SD1_CLK_B enum IDs are used twice, which means
one set of users must be wrong.  Replace them by the correct enum IDs.

Fixes: 87f8c98863 ("sh-pfc: Add r8a7778 pinmux support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20191218194812.12741-2-geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:27 -05:00
Gustavo A. R. Silva
db5c145466 media: i2c: adv748x: Fix unsafe macros
commit 0d962e061a upstream.

Enclose multiple macro parameters in parentheses in order to
make such macros safer and fix the Clang warning below:

drivers/media/i2c/adv748x/adv748x-afe.c:452:12: warning: operator '?:'
has lower precedence than '|'; '|' will be evaluated first
[-Wbitwise-conditional-parentheses]

ret = sdp_clrset(state, ADV748X_SDP_FRP, ADV748X_SDP_FRP_MASK, enable
? ctrl->val - 1 : 0);

Fixes: 3e89586a64 ("media: i2c: adv748x: add adv748x driver")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:27 -05:00
Eric Biggers
b772f3c499 crypto: atmel-sha - fix error handling when setting hmac key
commit b529f1983b upstream.

HMAC keys can be of any length, and atmel_sha_hmac_key_set() can only
fail due to -ENOMEM.  But atmel_sha_hmac_setkey() incorrectly treated
any error as a "bad key length" error.  Fix it to correctly propagate
the -ENOMEM error code and not set any tfm result flags.

Fixes: 81d8750b2b ("crypto: atmel-sha - add support to hmac(shaX)")
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:27 -05:00
Eric Biggers
e1254ca723 crypto: artpec6 - return correct error code for failed setkey()
commit b828f90590 upstream.

->setkey() is supposed to retun -EINVAL for invalid key lengths, not -1.

Fixes: a21eb94fc4 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Lars Persson <lars.persson@axis.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Lars Persson <lars.persson@axis.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:27 -05:00
YueHaibing
a23409cee4 mtd: sharpslpart: Fix unsigned comparison to zero
commit f33113b542 upstream.

The unsigned variable log_num is being assigned a return value
from the call to sharpsl_nand_get_logical_num that can return
-EINVAL.

Detected using Coccinelle:
./drivers/mtd/parsers/sharpslpart.c:207:6-13: WARNING: Unsigned expression compared with zero: log_num > 0

Fixes: 8a4580e4d2 ("mtd: sharpslpart: Add sharpslpart partition parser")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:27 -05:00
Nathan Chancellor
ad13249bfa mtd: onenand_base: Adjust indentation in onenand_read_ops_nolock
commit 0e7ca83e82 upstream.

Clang warns:

../drivers/mtd/nand/onenand/onenand_base.c:1269:3: warning: misleading
indentation; statement is not part of the previous 'if'
[-Wmisleading-indentation]
        while (!ret) {
        ^
../drivers/mtd/nand/onenand/onenand_base.c:1266:2: note: previous
statement is here
        if (column + thislen > writesize)
        ^
1 warning generated.

This warning occurs because there is a space before the tab of the while
loop. There are spaces at the beginning of a lot of the lines in this
block, remove them so that the indentation is consistent with the Linux
kernel coding style and clang no longer warns.

Fixes: a8de85d557 ("[MTD] OneNAND: Implement read-while-load")
Link: https://github.com/ClangBuiltLinux/linux/issues/794
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
Eric Auger
b818a55bc4 KVM: arm64: pmu: Don't increment SW_INCR if PMCR.E is unset
commit 3837407c1a upstream.

The specification says PMSWINC increments PMEVCNTR<n>_EL1 by 1
if PMEVCNTR<n>_EL0 is enabled and configured to count SW_INCR.

For PMEVCNTR<n>_EL0 to be enabled, we need both PMCNTENSET to
be set for the corresponding event counter but we also need
the PMCR.E bit to be set.

Fixes: 7a0adc7064 ("arm64: KVM: Add access handler for PMSWINC register")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200124142535.29386-2-eric.auger@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
James Morse
f8d4dfffbb KVM: arm: Make inject_abt32() inject an external abort instead
commit 21aecdbd7f upstream.

KVM's inject_abt64() injects an external-abort into an aarch64 guest.
The KVM_CAP_ARM_INJECT_EXT_DABT is intended to do exactly this, but
for an aarch32 guest inject_abt32() injects an implementation-defined
exception, 'Lockdown fault'.

Change this to external abort. For non-LPAE we now get the documented:
| Unhandled fault: external abort on non-linefetch (0x008) at 0x9c800f00
and for LPAE:
| Unhandled fault: synchronous external abort (0x210) at 0x9c800f00

Fixes: 74a64a9816 ("KVM: arm/arm64: Unify 32bit fault injection")
Reported-by: Beata Michalska <beata.michalska@linaro.org>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200121123356.203000-3-james.morse@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
James Morse
8ea83328b2 KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests
commit 018f22f95e upstream.

Beata reports that KVM_SET_VCPU_EVENTS doesn't inject the expected
exception to a non-LPAE aarch32 guest.

The host intends to inject DFSR.FS=0x14 "IMPLEMENTATION DEFINED fault
(Lockdown fault)", but the guest receives DFSR.FS=0x04 "Fault on
instruction cache maintenance". This fault is hooked by
do_translation_fault() since ARMv6, which goes on to silently 'handle'
the exception, and restart the faulting instruction.

It turns out, when TTBCR.EAE is clear DFSR is split, and FS[4] has
to shuffle up to DFSR[10].

As KVM only does this in one place, fix up the static values. We
now get the expected:
| Unhandled fault: lock abort (0x404) at 0x9c800f00

Fixes: 74a64a9816 ("KVM: arm/arm64: Unify 32bit fault injection")
Reported-by: Beata Michalska <beata.michalska@linaro.org>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200121123356.203000-2-james.morse@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
Gavin Shan
5b63ffb30b KVM: arm/arm64: Fix young bit from mmu notifier
commit cf2d23e0ba upstream.

kvm_test_age_hva() is called upon mmu_notifier_test_young(), but wrong
address range has been passed to handle_hva_to_gpa(). With the wrong
address range, no young bits will be checked in handle_hva_to_gpa().
It means zero is always returned from mmu_notifier_test_young().

This fixes the issue by passing correct address range to the underly
function handle_hva_to_gpa(), so that the hardware young (access) bit
will be visited.

Fixes: 35307b9a5f ("arm/arm64: KVM: Implement Stage-2 page aging")
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200121055659.19560-1-gshan@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
Suzuki K Poulose
0e0310adf2 arm64: ptrace: nofpsimd: Fail FP/SIMD regset operations
commit c9d66999f0 upstream.

When fp/simd is not supported on the system, fail the operations
of FP/SIMD regsets.

Fixes: 82e0191a1a ("arm64: Support systems without FP/ASIMD")
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
Suzuki K Poulose
12e2dca1f2 arm64: cpufeature: Fix the type of no FP/SIMD capability
commit 449443c03d upstream.

The NO_FPSIMD capability is defined with scope SYSTEM, which implies
that the "absence" of FP/SIMD on at least one CPU is detected only
after all the SMP CPUs are brought up. However, we use the status
of this capability for every context switch. So, let us change
the scope to LOCAL_CPU to allow the detection of this capability
as and when the first CPU without FP is brought up.

Also, the current type allows hotplugged CPU to be brought up without
FP/SIMD when all the current CPUs have FP/SIMD and we have the userspace
up. Fix both of these issues by changing the capability to
BOOT_RESTRICTED_LOCAL_CPU_FEATURE.

Fixes: 82e0191a1a ("arm64: Support systems without FP/ASIMD")
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00
Olof Johansson
f1025b2f75 ARM: 8949/1: mm: mark free_memmap as __init
commit 31f3010e60 upstream.

As of commit ac7c3e4ff4 ("compiler: enable CONFIG_OPTIMIZE_INLINING
forcibly"), free_memmap() might not always be inlined, and thus is
triggering a section warning:

WARNING: vmlinux.o(.text.unlikely+0x904): Section mismatch in reference from the function free_memmap() to the function .meminit.text:memblock_free()

Mark it as __init, since the faller (free_unused_memmap) already is.

Fixes: ac7c3e4ff4 ("compiler: enable CONFIG_OPTIMIZE_INLINING forcibly")
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:33:26 -05:00