Skip to content
  1. May 28, 2021
    • Aurelien Aptel's avatar
      cifs: change format of CIFS_FULL_KEY_DUMP ioctl · 1bb56810
      Aurelien Aptel authored
      
      
      Make CIFS_FULL_KEY_DUMP ioctl able to return variable-length keys.
      
      * userspace needs to pass the struct size along with optional
        session_id and some space at the end to store keys
      * if there is enough space kernel returns keys in the extra space and
        sets the length of each key via xyz_key_length fields
      
      This also fixes the build error for get_user() on ARM.
      
      Sample program:
      
      	#include <stdlib.h>
      	#include <stdio.h>
      	#include <stdint.h>
      	#include <sys/fcntl.h>
      	#include <sys/ioctl.h>
      
      	struct smb3_full_key_debug_info {
      	        uint32_t   in_size;
      	        uint64_t   session_id;
      	        uint16_t   cipher_type;
      	        uint8_t    session_key_length;
      	        uint8_t    server_in_key_length;
      	        uint8_t    server_out_key_length;
      	        uint8_t    data[];
      	        /*
      	         * return this struct with the keys appended at the end:
      	         * uint8_t session_key[session_key_length];
      	         * uint8_t server_in_key[server_in_key_length];
      	         * uint8_t server_out_key[server_out_key_length];
      	         */
      	} __attribute__((packed));
      
      	#define CIFS_IOCTL_MAGIC 0xCF
      	#define CIFS_DUMP_FULL_KEY _IOWR(CIFS_IOCTL_MAGIC, 10, struct smb3_full_key_debug_info)
      
      	void dump(const void *p, size_t len) {
      	        const char *hex = "0123456789ABCDEF";
      	        const uint8_t *b = p;
      	        for (int i = 0; i < len; i++)
      	                printf("%c%c ", hex[(b[i]>>4)&0xf], hex[b[i]&0xf]);
      	        putchar('\n');
      	}
      
      	int main(int argc, char **argv)
      	{
      	        struct smb3_full_key_debug_info *keys;
      	        uint8_t buf[sizeof(*keys)+1024] = {0};
      	        size_t off = 0;
      	        int fd, rc;
      
      	        keys = (struct smb3_full_key_debug_info *)&buf;
      	        keys->in_size = sizeof(buf);
      
      	        fd = open(argv[1], O_RDONLY);
      	        if (fd < 0)
      	                perror("open"), exit(1);
      
      	        rc = ioctl(fd, CIFS_DUMP_FULL_KEY, keys);
      	        if (rc < 0)
      	                perror("ioctl"), exit(1);
      
      	        printf("SessionId      ");
      	        dump(&keys->session_id, 8);
      	        printf("Cipher         %04x\n", keys->cipher_type);
      
      	        printf("SessionKey     ");
      	        dump(keys->data+off, keys->session_key_length);
      	        off += keys->session_key_length;
      
      	        printf("ServerIn Key   ");
      	        dump(keys->data+off, keys->server_in_key_length);
      	        off += keys->server_in_key_length;
      
      	        printf("ServerOut Key  ");
      	        dump(keys->data+off, keys->server_out_key_length);
      
      	        return 0;
      	}
      
      Usage:
      
      	$ gcc -o dumpkeys dumpkeys.c
      
      Against Windows Server 2020 preview (with AES-256-GCM support):
      
      	# mount.cifs //$ip/test /mnt -o "username=administrator,password=foo,vers=3.0,seal"
      	# ./dumpkeys /mnt/somefile
      	SessionId      0D 00 00 00 00 0C 00 00
      	Cipher         0002
      	SessionKey     AB CD CC 0D E4 15 05 0C 6F 3C 92 90 19 F3 0D 25
      	ServerIn Key   73 C6 6A C8 6B 08 CF A2 CB 8E A5 7D 10 D1 5B DC
      	ServerOut Key  6D 7E 2B A1 71 9D D7 2B 94 7B BA C4 F0 A5 A4 F8
      	# umount /mnt
      
      	With 256 bit keys:
      
      	# echo 1 > /sys/module/cifs/parameters/require_gcm_256
      	# mount.cifs //$ip/test /mnt -o "username=administrator,password=foo,vers=3.11,seal"
      	# ./dumpkeys /mnt/somefile
      	SessionId      09 00 00 00 00 0C 00 00
      	Cipher         0004
      	SessionKey     93 F5 82 3B 2F B7 2A 50 0B B9 BA 26 FB 8C 8B 03
      	ServerIn Key   6C 6A 89 B2 CB 7B 78 E8 04 93 37 DA 22 53 47 DF B3 2C 5F 02 26 70 43 DB 8D 33 7B DC 66 D3 75 A9
      	ServerOut Key  04 11 AA D7 52 C7 A8 0F ED E3 93 3A 65 FE 03 AD 3F 63 03 01 2B C0 1B D7 D7 E5 52 19 7F CC 46 B4
      
      Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      1bb56810
    • Shyam Prasad N's avatar
      cifs: fix string declarations and assignments in tracepoints · eb068818
      Shyam Prasad N authored
      
      
      We missed using the variable length string macros in several
      tracepoints. Fixed them in this change.
      
      There's probably more useful macros that we can use to print
      others like flags etc. But I'll submit sepawrate patches for
      those at a future date.
      
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Cc: <stable@vger.kernel.org> # v5.12
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      eb068818
    • Aurelien Aptel's avatar
      cifs: set server->cipher_type to AES-128-CCM for SMB3.0 · 6d2fcfe6
      Aurelien Aptel authored
      
      
      SMB3.0 doesn't have encryption negotiate context but simply uses
      the SMB2_GLOBAL_CAP_ENCRYPTION flag.
      
      When that flag is present in the neg response cifs.ko uses AES-128-CCM
      which is the only cipher available in this context.
      
      cipher_type was set to the server cipher only when parsing encryption
      negotiate context (SMB3.1.1).
      
      For SMB3.0 it was set to 0. This means cipher_type value can be 0 or 1
      for AES-128-CCM.
      
      Fix this by checking for SMB3.0 and encryption capability and setting
      cipher_type appropriately.
      
      Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      6d2fcfe6
  2. May 24, 2021
  3. May 23, 2021
  4. May 22, 2021
    • Linus Torvalds's avatar
      Merge tag 'xfs-5.13-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · a3969ef4
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
      
       - Fix some math errors in the realtime allocator when extent size hints
         are applied.
      
       - Fix unnecessary short writes to realtime files when free space is
         fragmented.
      
       - Fix a crash when using scrub tracepoints.
      
       - Restore ioctl uapi definitions that were accidentally removed in
         5.13-rc1.
      
      * tag 'xfs-5.13-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: restore old ioctl definitions
        xfs: fix deadlock retry tracepoint arguments
        xfs: retry allocations when locality-based search fails
        xfs: adjust rt allocation minlen when extszhint > rtextsize
      a3969ef4
    • Linus Torvalds's avatar
      Merge tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 45af60e7
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few more fixes:
      
         - fix unaligned compressed writes in zoned mode
      
         - fix false positive lockdep warning when cloning inline extent
      
         - remove wrong BUG_ON in tree-log error handling"
      
      * tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: zoned: fix parallel compressed writes
        btrfs: zoned: pass start block to btrfs_use_zone_append
        btrfs: do not BUG_ON in link_to_fixup_dir
        btrfs: release path before starting transaction when cloning inline extent
      45af60e7
    • Linus Torvalds's avatar
      Merge tag '5.13-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6 · 8bb14ca1
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Seven smb3 fixes: one for stable, three others fix problems found in
        testing handle leases, and a compounded request fix"
      
      * tag '5.13-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6:
        Fix KASAN identified use-after-free issue.
        Defer close only when lease is enabled.
        Fix kernel oops when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.
        cifs: Fix inconsistent indenting
        cifs: fix memory leak in smb2_copychunk_range
        SMB3: incorrect file id in requests compounded with open
        cifs: remove deadstore in cifs_close_all_deferred_files()
      8bb14ca1
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · e8085a07
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - add missing MODULE_DEVICE_TABLE in gpio-cadence
      
       - fix a kernel doc validator error in gpio-xilinx
      
       - don't set parent IRQ affinity in gpio-tegra186
      
      * tag 'gpio-fixes-for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: tegra186: Don't set parent IRQ affinity
        gpio: xilinx: Correct kernel doc for xgpio_probe()
        gpio: cadence: Add missing MODULE_DEVICE_TABLE
      e8085a07
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 011ff616
      Linus Torvalds authored
      Pull MMC host fixes from Ulf Hansson:
      
       - Fix SD-card detection on Intel NUC10i3FNK4 (GL9755)
      
       - Replace WARN_ONCE with dev_warn_once for scatterlist offsets
      
       - Extend check of scatterlist size alignment with SD_IO_RW_EXTENDED
      
      * tag 'mmc-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: sdhci-pci-gli: increase 1.8V regulator wait
        mmc: meson-gx: also check SD_IO_RW_EXTENDED for scatterlist size alignment
        mmc: meson-gx: make replace WARN_ONCE with dev_warn_once about scatterlist offset alignment
      011ff616
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 5328bf8b
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Another batch of removing unneeded type references in schemas
      
       - Fix some out of date filename references
      
       - Convert renesas,drif schema to use DT graph schema
      
      * tag 'devicetree-fixes-for-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: More removals of type references on common properties
        dt-bindings: media: renesas,drif: Use graph schema
        leds: Fix reference file name of documentation
        dt-bindings: phy: cadence-torrent: update reference file of docs
      5328bf8b
    • Linus Torvalds's avatar
      Merge branch 'for-v5.13-rc3' of... · a0e31f3a
      Linus Torvalds authored
      Merge branch 'for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
      
      Pull siginfo fix from Eric Biederman:
       "During the merge window an issue with si_perf and the siginfo ABI came
        up. The alpha and sparc siginfo structure layout had changed with the
        addition of SIGTRAP TRAP_PERF and the new field si_perf.
      
        The reason only alpha and sparc were affected is that they are the
        only architectures that use si_trapno.
      
        Looking deeper it was discovered that si_trapno is used for only a few
        select signals on alpha and sparc, and that none of the other
        _sigfault fields past si_addr are used at all. Which means technically
        no regression on alpha and sparc.
      
        While the alignment concerns might be dismissed the abuse of si_errno
        by SIGTRAP TRAP_PERF does have the potential to cause regressions in
        existing userspace.
      
        While we still have time before userspace starts using and depending
        on the new definition siginfo for SIGTRAP TRAP_PERF this set of
        changes cleans up siginfo_t.
      
         - The si_trapno field is demoted from magic alpha and sparc status
           and made an ordinary union member of the _sigfault member of
           siginfo_t. Without moving it of course.
      
         - si_perf is replaced with si_perf_data and si_perf_type ending the
           abuse of si_errno.
      
         - Unnecessary additions to signalfd_siginfo are removed"
      
      * 'for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
        signalfd: Remove SIL_PERF_EVENT fields from signalfd_siginfo
        signal: Deliver all of the siginfo perf data in _perf
        signal: Factor force_sig_perf out of perf_sigtrap
        signal: Implement SIL_FAULT_TRAPNO
        siginfo: Move si_trapno inside the union inside _si_fault
      a0e31f3a
    • Linus Torvalds's avatar
      Merge tag 'modules-for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux · c1f47ebc
      Linus Torvalds authored
      Pull module fix from Jessica Yu:
       "When CONFIG_MODULE_UNLOAD=n, module exit sections get sorted into the
        init region of the module in order to satisfy the requirements of
        jump_labels and static_calls.
      
        Previously, the exit section check was done in module_init_section(),
        but the solution there is not completely arch-indepedent as ARM is a
        special case and supplies its own module_init_section() function.
      
        Instead of pushing this logic further to the arch-specific code,
        switch to an arch-independent solution to check for module exit
        sections in the core module loader code in layout_sections() instead"
      
      * tag 'modules-for-v5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
        module: check for exit sections in layout_sections() instead of module_init_section()
      c1f47ebc
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/openrisc/linux · 93bb533a
      Linus Torvalds authored
      Pull OpenRISC fixes from Stafford Horne:
       "A few fixes that came in around the time of the merge window"
      
      * tag 'for-linus' of git://github.com/openrisc/linux:
        openrisc: Define memory barrier mb
        openrisc: mm/init.c: remove unused variable 'end' in paging_init()
        openrisc: mm/init.c: remove unused memblock_region variable in map_ram()
        openrisc: Fix a memory leak
      93bb533a
  5. May 21, 2021