Merge android-4.19-stable.113 (2b82910d
) into msm-4.19
* refs/heads/tmp-2b82910d: Reverting incrementalfs, power,usb and scheduler changes ANDROID: Incremental fs: Fix four resource bugs ANDROID: Bulk update the ABI xml based on the referenced bugs. ANDROID: GKI: block: resolve ABI diff when CONFIG_BLK_DEV_BSG is unset ANDROID: GKI: bfq-iosched: update struct elevator_mq_ops ABI ANDROID: GKI: locking/rwsem: add vendor field to struct rw_semaphore ANDROID: GKI: fs: add umount_end() function to struct super_operations ANDROID: GKI: perf: Add fields for CPU hotplug feature ANDROID: GKI: perf: Add field for struct perf_event ANDROID: GKI: cpuset: add field for task affinity for cpusets UPSTREAM: ubifs: wire up FS_IOC_GET_ENCRYPTION_NONCE UPSTREAM: f2fs: wire up FS_IOC_GET_ENCRYPTION_NONCE UPSTREAM: ext4: wire up FS_IOC_GET_ENCRYPTION_NONCE UPSTREAM: fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl UPSTREAM: usb: raw_gadget: fix compilation warnings in uapi headers BACKPORT: usb: gadget: add raw-gadget interface UPSTREAM: usb: gadget: move choice ... endchoice to legacy/Kconfig UPSTREAM: ipv6: ndisc: add support for 'PREF64' dns64 prefix identifier ANDROID: GKI: Removed cuttlefish configs ANDROID: GKI: Removed cuttlefish configs ANDROID: clang: update to 10.0.5 FROMLIST: arm64: define __alloc_zeroed_user_highpage ANDROID: Incremental fs: Add INCFS_IOC_GET_FILLED_BLOCKS ANDROID: Incremental fs: Fix two typos ANDROID: GKI: Update ABI ANDROID: GKI: power_supply: add more soc properties ANDROID: GKI: Update ABI ANDROID: GKI: google_battery: return string type for serial_number property ANDROID: GKI: power: supply: Add APSD based power-supply properties ANDROID: GKI: power: supply: Remove "Wipower" PSY type ANDROID: GKI: power: supply: Add support for HVDCP_3P5 ANDROID: GKI: power_supply: Define Debug Accessory Mode ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_AICL_* ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_ALIGNMENT ANDROID: GKI: power_supply: Add CP_ISNS_SLAVE power supply property ANDROID: GKI: power_supply: add properties to report parallel connection topology ANDROID: GKI: power_supply: add POWER_SUPPLY_PROP_IRQ_STATUS property ANDROID: GKI: power: supply: add CHARGE_CHARGER_STATE property ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_PTMC_ID ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_OTG_FASTROLESWAP ANDROID: GKI: power: supply: Add VOLTAGE_STEP property ANDROID: GKI: power: supply: Add AICL_DONE parameter ANDROID: GKI: power_supply: Add operating frequency property ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CC_UAH ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_VOLTAGE_FIFO ANDROID: GKI: power: supply: Add capacity and resistance estimates ANDROID: GKI: power_supply: Add vendor specific dead battery property ANDROID: GKI: power-supply: add ADAPTER_DETAILS power supply property ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CHARGE_DISABLE ANDROID: GKI: power: power_supply: Add property to display skin thermal status ANDROID: GKI: power_supply: Add properties to support PPS constant current(CC) mode ANDROID: GKI: power: power_supply: Add REAL_CAPACITY property ANDROID: GKI: power_supply: Add VOLTAGE_MAX_LIMIT power supply property ANDROID: GKI: power_supply: Add DC_RESET power-supply property ANDROID: GKI: power_supply: Add "THERM_ICL_LIMIT" property ANDROID: GKI: power_supply: add CHIP_VERSION property ANDROID: GKI: power-supply: Add VOLTAGE_VPH power supply property ANDROID: GKI: power_supply: Add SCALE_MODE_EN power-supply property ANDROID: GKI: power_supply: Add local extensions of string property names properly ANDROID: GKI: power_supply: add batt_age_level property ANDROID: GKI: power-supply: Add CC_SOC power supply property ANDROID: GKI: power_supply: add property to disable QC userspace optimizations ANDROID: GKI: power: power_supply: Add FG_RESET power supply property ANDROID: GKI: power_supply: Add power supply type "Charge Pump" ANDROID: GKI: power: supply: Add snapshot of power supply framework files ANDROID: GKI: power: power_supply: Add property CHARGE_COUNTER_EXT and 64-bit precision properties ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_CHARGE_ENABLED ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_USB_OTG ANDROID: GKI: power: power_supply: Add custom property for USB High Current mode UPSTREAM: coresight: Potential uninitialized variable in probe() ANDROID: GKI: Update ABI. ANDROID: GKI: Add API to create pagetable mappings. ANDROID: GKI: drivers: usb: Add functions usb_func_ep_queue/usb_func_wakeup ANDROID: GKI: Add API usb_ep_autoconfig_by_name ANDROID: GKI: usb: core: Add helper function to return controller id ANDROID: dm-bow: Fix free_show value is incorrect ANDROID: GKI: update ABI after fixing cfg80211_chan_def diff BACKPORT: nl80211: Add support for EDMG channels FROMGIT: sched/rt: cpupri_find: Trigger a full search as fallback FROMGIT: sched/rt: Remove unnecessary push for unfit tasks BACKPORT: FROMGIT: sched/rt: Allow pulling unfitting task FROMGIT: sched/rt: Optimize cpupri_find() on non-heterogenous systems FROMGIT: sched/rt: Re-instate old behavior in select_task_rq_rt() BACKPORT: FROMGIT: sched/rt: cpupri_find: Implement fallback mechanism for !fit case ANDROID: GKI: re-enable LTO, CFI and SCS Conflicts: arch/arm64/mm/mmu.c drivers/net/wireless/ath/wil6210/cfg80211.c drivers/usb/gadget/Kconfig include/linux/memblock.h include/linux/perf_event.h include/linux/rwsem.h include/uapi/linux/nl80211.h Change-Id: I7aa8a1712c323fc5a2eced52a07bfb6df6996ba0 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
commit
18ffdaaa38
31 changed files with 78998 additions and 78384 deletions
|
@ -633,6 +633,17 @@ from a passphrase or other low-entropy user credential.
|
|||
FS_IOC_GET_ENCRYPTION_PWSALT is deprecated. Instead, prefer to
|
||||
generate and manage any needed salt(s) in userspace.
|
||||
|
||||
Getting a file's encryption nonce
|
||||
---------------------------------
|
||||
|
||||
Since Linux v5.7, the ioctl FS_IOC_GET_ENCRYPTION_NONCE is supported.
|
||||
On encrypted files and directories it gets the inode's 16-byte nonce.
|
||||
On unencrypted files and directories, it fails with ENODATA.
|
||||
|
||||
This ioctl can be useful for automated tests which verify that the
|
||||
encryption is being done correctly. It is not needed for normal use
|
||||
of fscrypt.
|
||||
|
||||
Adding keys
|
||||
-----------
|
||||
|
||||
|
|
61
Documentation/usb/raw-gadget.rst
Normal file
61
Documentation/usb/raw-gadget.rst
Normal file
|
@ -0,0 +1,61 @@
|
|||
==============
|
||||
USB Raw Gadget
|
||||
==============
|
||||
|
||||
USB Raw Gadget is a kernel module that provides a userspace interface for
|
||||
the USB Gadget subsystem. Essentially it allows to emulate USB devices
|
||||
from userspace. Enabled with CONFIG_USB_RAW_GADGET. Raw Gadget is
|
||||
currently a strictly debugging feature and shouldn't be used in
|
||||
production, use GadgetFS instead.
|
||||
|
||||
Comparison to GadgetFS
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Raw Gadget is similar to GadgetFS, but provides a more low-level and
|
||||
direct access to the USB Gadget layer for the userspace. The key
|
||||
differences are:
|
||||
|
||||
1. Every USB request is passed to the userspace to get a response, while
|
||||
GadgetFS responds to some USB requests internally based on the provided
|
||||
descriptors. However note, that the UDC driver might respond to some
|
||||
requests on its own and never forward them to the Gadget layer.
|
||||
|
||||
2. GadgetFS performs some sanity checks on the provided USB descriptors,
|
||||
while Raw Gadget allows you to provide arbitrary data as responses to
|
||||
USB requests.
|
||||
|
||||
3. Raw Gadget provides a way to select a UDC device/driver to bind to,
|
||||
while GadgetFS currently binds to the first available UDC.
|
||||
|
||||
4. Raw Gadget uses predictable endpoint names (handles) across different
|
||||
UDCs (as long as UDCs have enough endpoints of each required transfer
|
||||
type).
|
||||
|
||||
5. Raw Gadget has ioctl-based interface instead of a filesystem-based one.
|
||||
|
||||
Userspace interface
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To create a Raw Gadget instance open /dev/raw-gadget. Multiple raw-gadget
|
||||
instances (bound to different UDCs) can be used at the same time. The
|
||||
interaction with the opened file happens through the ioctl() calls, see
|
||||
comments in include/uapi/linux/usb/raw_gadget.h for details.
|
||||
|
||||
The typical usage of Raw Gadget looks like:
|
||||
|
||||
1. Open Raw Gadget instance via /dev/raw-gadget.
|
||||
2. Initialize the instance via USB_RAW_IOCTL_INIT.
|
||||
3. Launch the instance with USB_RAW_IOCTL_RUN.
|
||||
4. In a loop issue USB_RAW_IOCTL_EVENT_FETCH calls to receive events from
|
||||
Raw Gadget and react to those depending on what kind of USB device
|
||||
needs to be emulated.
|
||||
|
||||
Potential future improvements
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Implement ioctl's for setting/clearing halt status on endpoints.
|
||||
|
||||
- Reporting more events (suspend, resume, etc.) through
|
||||
USB_RAW_IOCTL_EVENT_FETCH.
|
||||
|
||||
- Support O_NONBLOCK I/O.
|
155834
abi_gki_aarch64.xml
155834
abi_gki_aarch64.xml
File diff suppressed because it is too large
Load diff
|
@ -78,6 +78,9 @@ CONFIG_ARM64_CRYPTO=y
|
|||
CONFIG_CRYPTO_SHA2_ARM64_CE=y
|
||||
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
|
||||
CONFIG_JUMP_LABEL=y
|
||||
CONFIG_LTO_CLANG=y
|
||||
CONFIG_CFI_CLANG=y
|
||||
CONFIG_SHADOW_CALL_STACK=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODVERSIONS=y
|
||||
|
|
|
@ -32,6 +32,10 @@ extern void __cpu_copy_user_page(void *to, const void *from,
|
|||
extern void copy_page(void *to, const void *from);
|
||||
extern void clear_page(void *to);
|
||||
|
||||
#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
|
||||
alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
|
||||
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
||||
|
||||
#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr)
|
||||
#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr)
|
||||
|
||||
|
|
|
@ -399,13 +399,26 @@ static phys_addr_t pgd_pgtable_alloc(void)
|
|||
return __pa(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* create_pgtable_mapping - create a pagetable mapping for given
|
||||
* physical start and end addresses.
|
||||
* @start: physical start address.
|
||||
* @end: physical end address.
|
||||
*/
|
||||
void create_pgtable_mapping(phys_addr_t start, phys_addr_t end)
|
||||
{
|
||||
unsigned long virt = (unsigned long)phys_to_virt(start);
|
||||
|
||||
if (virt < VMALLOC_START) {
|
||||
pr_warn("BUG: not creating mapping for %pa at 0x%016lx - outside kernel range\n",
|
||||
&start, virt);
|
||||
return;
|
||||
}
|
||||
|
||||
__create_pgd_mapping(init_mm.pgd, start, virt, end - start,
|
||||
PAGE_KERNEL, NULL, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(create_pgtable_mapping);
|
||||
|
||||
/*
|
||||
* This function can only be used to modify existing table entries,
|
||||
|
|
|
@ -5,7 +5,7 @@ CC=clang
|
|||
LD=ld.lld
|
||||
NM=llvm-nm
|
||||
OBJCOPY=llvm-objcopy
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r377782b/bin
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r377782c/bin
|
||||
|
||||
EXTRA_CMDS=''
|
||||
STOP_SHIP_TRACEPRINTK=1
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
. ${ROOT_DIR}/common/build.config.common
|
||||
. ${ROOT_DIR}/common/build.config.aarch64
|
||||
. ${ROOT_DIR}/common/build.config.gki
|
||||
|
||||
BUILD_INITRAMFS=1
|
||||
DEFCONFIG=cf_aarch_64_gki_defconfig
|
||||
PRE_DEFCONFIG_CMDS="KCONFIG_CONFIG=${ROOT_DIR}/common/arch/arm64/configs/${DEFCONFIG} ${ROOT_DIR}/common/scripts/kconfig/merge_config.sh -m -r ${ROOT_DIR}/common/arch/arm64/configs/gki_defconfig ${ROOT_DIR}/common/cuttlefish.fragment"
|
||||
POST_DEFCONFIG_CMDS="rm ${ROOT_DIR}/common/arch/arm64/configs/${DEFCONFIG}"
|
||||
|
||||
# Not saving any kernel images. This build step is meant purely to generate the .kos.
|
||||
FILES=""
|
|
@ -1,11 +0,0 @@
|
|||
. ${ROOT_DIR}/common/build.config.common
|
||||
. ${ROOT_DIR}/common/build.config.x86_64
|
||||
. ${ROOT_DIR}/common/build.config.gki
|
||||
|
||||
BUILD_INITRAMFS=1
|
||||
DEFCONFIG=cf_x86_64_gki_defconfig
|
||||
PRE_DEFCONFIG_CMDS="KCONFIG_CONFIG=${ROOT_DIR}/common/arch/x86/configs/${DEFCONFIG} ${ROOT_DIR}/common/scripts/kconfig/merge_config.sh -m -r ${ROOT_DIR}/common/arch/x86/configs/gki_defconfig ${ROOT_DIR}/common/cuttlefish.fragment"
|
||||
POST_DEFCONFIG_CMDS="rm ${ROOT_DIR}/common/arch/x86/configs/${DEFCONFIG}"
|
||||
|
||||
# Not saving any kernel images. This build step is meant purely to generate the .kos.
|
||||
FILES=""
|
|
@ -1,24 +0,0 @@
|
|||
CONFIG_CPUFREQ_DUMMY=m
|
||||
CONFIG_VSOCKETS=m
|
||||
CONFIG_VIRTIO_VSOCKETS=m
|
||||
CONFIG_GNSS_CMDLINE_SERIAL=m
|
||||
CONFIG_VIRTIO_BLK=m
|
||||
CONFIG_VIRTIO_NET=m
|
||||
CONFIG_VIRT_WIFI=m
|
||||
CONFIG_HW_RANDOM_VIRTIO=m
|
||||
CONFIG_DRM_VIRTIO_GPU=m
|
||||
CONFIG_SND_INTEL8X0=m
|
||||
CONFIG_USB_DUMMY_HCD=m
|
||||
CONFIG_RTC_DRV_TEST=m
|
||||
CONFIG_VIRTIO_PCI=m
|
||||
CONFIG_VIRTIO_PMEM=m
|
||||
CONFIG_VIRTIO_INPUT=m
|
||||
CONFIG_VIRTIO_MMIO=m
|
||||
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
|
||||
CONFIG_ION=m
|
||||
CONFIG_ION_SYSTEM_HEAP=y
|
||||
CONFIG_TEST_STACKINIT=m
|
||||
CONFIG_TEST_MEMINIT=m
|
||||
CONFIG_SDCARD_FS=m
|
||||
CONFIG_TCG_TPM=m
|
||||
CONFIG_TCG_VTPM_PROXY=m
|
|
@ -303,6 +303,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
|
|||
}
|
||||
|
||||
pm_runtime_put(dev);
|
||||
ret = 0;
|
||||
|
||||
out_disable_clk:
|
||||
if (ret && !IS_ERR_OR_NULL(drvdata->atclk))
|
||||
|
|
|
@ -792,6 +792,7 @@ static int prepare_unchanged_range(struct bow_context *bc, struct bow_range *br,
|
|||
*/
|
||||
original_type = br->type;
|
||||
sector0 = backup_br->sector;
|
||||
bc->trims_total -= range_size(backup_br);
|
||||
if (backup_br->type == TRIMMED)
|
||||
list_del(&backup_br->trimmed_list);
|
||||
backup_br->type = br->type == SECTOR0_CURRENT ? SECTOR0_CURRENT
|
||||
|
|
|
@ -616,34 +616,6 @@ config USB_CONFIGFS_F_PTP
|
|||
at the file level. Thus exposing the relevant content but hiding
|
||||
the system/restricted files.
|
||||
|
||||
choice
|
||||
tristate "USB Gadget precomposed configurations"
|
||||
default USB_ETH
|
||||
optional
|
||||
help
|
||||
A Linux "Gadget Driver" talks to the USB Peripheral Controller
|
||||
driver through the abstract "gadget" API. Some other operating
|
||||
systems call these "client" drivers, of which "class drivers"
|
||||
are a subset (implementing a USB device class specification).
|
||||
A gadget driver implements one or more USB functions using
|
||||
the peripheral hardware.
|
||||
|
||||
Gadget drivers are hardware-neutral, or "platform independent",
|
||||
except that they sometimes must understand quirks or limitations
|
||||
of the particular controllers they work with. For example, when
|
||||
a controller doesn't support alternate configurations or provide
|
||||
enough of the right types of endpoints, the gadget driver might
|
||||
not be able work with that controller, or might need to implement
|
||||
a less common variant of a device class protocol.
|
||||
|
||||
The available choices each represent a single precomposed USB
|
||||
gadget configuration. In the device model, each option contains
|
||||
both the device instantiation as a child for a USB gadget
|
||||
controller, and the relevant drivers for each function declared
|
||||
by the device.
|
||||
|
||||
source "drivers/usb/gadget/legacy/Kconfig"
|
||||
|
||||
endchoice
|
||||
|
||||
endif # USB_GADGET
|
||||
|
|
|
@ -13,6 +13,32 @@
|
|||
# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
|
||||
#
|
||||
|
||||
choice
|
||||
tristate "USB Gadget precomposed configurations"
|
||||
default USB_ETH
|
||||
optional
|
||||
help
|
||||
A Linux "Gadget Driver" talks to the USB Peripheral Controller
|
||||
driver through the abstract "gadget" API. Some other operating
|
||||
systems call these "client" drivers, of which "class drivers"
|
||||
are a subset (implementing a USB device class specification).
|
||||
A gadget driver implements one or more USB functions using
|
||||
the peripheral hardware.
|
||||
|
||||
Gadget drivers are hardware-neutral, or "platform independent",
|
||||
except that they sometimes must understand quirks or limitations
|
||||
of the particular controllers they work with. For example, when
|
||||
a controller doesn't support alternate configurations or provide
|
||||
enough of the right types of endpoints, the gadget driver might
|
||||
not be able work with that controller, or might need to implement
|
||||
a less common variant of a device class protocol.
|
||||
|
||||
The available choices each represent a single precomposed USB
|
||||
gadget configuration. In the device model, each option contains
|
||||
both the device instantiation as a child for a USB gadget
|
||||
controller, and the relevant drivers for each function declared
|
||||
by the device.
|
||||
|
||||
config USB_ZERO
|
||||
tristate "Gadget Zero (DEVELOPMENT)"
|
||||
select USB_LIBCOMPOSITE
|
||||
|
@ -490,3 +516,16 @@ config USB_G_WEBCAM
|
|||
|
||||
Say "y" to link the driver statically, or "m" to build a
|
||||
dynamically linked module called "g_webcam".
|
||||
|
||||
config USB_RAW_GADGET
|
||||
tristate "USB Raw Gadget"
|
||||
help
|
||||
USB Raw Gadget is a kernel module that provides a userspace interface
|
||||
for the USB Gadget subsystem. Essentially it allows to emulate USB
|
||||
devices from userspace. See Documentation/usb/raw-gadget.rst for
|
||||
details.
|
||||
|
||||
Say "y" to link the driver statically, or "m" to build a
|
||||
dynamically linked module called "raw_gadget".
|
||||
|
||||
endchoice
|
||||
|
|
|
@ -43,3 +43,4 @@ obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o
|
|||
obj-$(CONFIG_USB_G_NCM) += g_ncm.o
|
||||
obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o
|
||||
obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o
|
||||
obj-$(CONFIG_USB_RAW_GADGET) += raw_gadget.o
|
||||
|
|
1078
drivers/usb/gadget/legacy/raw_gadget.c
Normal file
1078
drivers/usb/gadget/legacy/raw_gadget.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -78,6 +78,26 @@ static inline int fscrypt_context_size(const union fscrypt_context *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check whether an fscrypt_context has a recognized version number and size */
|
||||
static inline bool fscrypt_context_is_valid(const union fscrypt_context *ctx,
|
||||
int ctx_size)
|
||||
{
|
||||
return ctx_size >= 1 && ctx_size == fscrypt_context_size(ctx);
|
||||
}
|
||||
|
||||
/* Retrieve the context's nonce, assuming the context was already validated */
|
||||
static inline const u8 *fscrypt_context_nonce(const union fscrypt_context *ctx)
|
||||
{
|
||||
switch (ctx->version) {
|
||||
case FSCRYPT_CONTEXT_V1:
|
||||
return ctx->v1.nonce;
|
||||
case FSCRYPT_CONTEXT_V2:
|
||||
return ctx->v2.nonce;
|
||||
}
|
||||
WARN_ON(1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#undef fscrypt_policy
|
||||
union fscrypt_policy {
|
||||
u8 version;
|
||||
|
|
|
@ -501,20 +501,8 @@ int fscrypt_get_encryption_info(struct inode *inode)
|
|||
goto out;
|
||||
}
|
||||
|
||||
switch (ctx.version) {
|
||||
case FSCRYPT_CONTEXT_V1:
|
||||
memcpy(crypt_info->ci_nonce, ctx.v1.nonce,
|
||||
FS_KEY_DERIVATION_NONCE_SIZE);
|
||||
break;
|
||||
case FSCRYPT_CONTEXT_V2:
|
||||
memcpy(crypt_info->ci_nonce, ctx.v2.nonce,
|
||||
FS_KEY_DERIVATION_NONCE_SIZE);
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
memcpy(crypt_info->ci_nonce, fscrypt_context_nonce(&ctx),
|
||||
FS_KEY_DERIVATION_NONCE_SIZE);
|
||||
|
||||
if (!fscrypt_supported_policy(&crypt_info->ci_policy, inode)) {
|
||||
res = -EINVAL;
|
||||
|
|
|
@ -262,7 +262,7 @@ int fscrypt_policy_from_context(union fscrypt_policy *policy_u,
|
|||
{
|
||||
memset(policy_u, 0, sizeof(*policy_u));
|
||||
|
||||
if (ctx_size <= 0 || ctx_size != fscrypt_context_size(ctx_u))
|
||||
if (!fscrypt_context_is_valid(ctx_u, ctx_size))
|
||||
return -EINVAL;
|
||||
|
||||
switch (ctx_u->version) {
|
||||
|
@ -485,6 +485,25 @@ int fscrypt_ioctl_get_policy_ex(struct file *filp, void __user *uarg)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(fscrypt_ioctl_get_policy_ex);
|
||||
|
||||
/* FS_IOC_GET_ENCRYPTION_NONCE: retrieve file's encryption nonce for testing */
|
||||
int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg)
|
||||
{
|
||||
struct inode *inode = file_inode(filp);
|
||||
union fscrypt_context ctx;
|
||||
int ret;
|
||||
|
||||
ret = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!fscrypt_context_is_valid(&ctx, ret))
|
||||
return -EINVAL;
|
||||
if (copy_to_user(arg, fscrypt_context_nonce(&ctx),
|
||||
FS_KEY_DERIVATION_NONCE_SIZE))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fscrypt_ioctl_get_nonce);
|
||||
|
||||
/**
|
||||
* fscrypt_has_permitted_context() - is a file's encryption policy permitted
|
||||
* within its directory?
|
||||
|
|
|
@ -1160,6 +1160,11 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
return -EOPNOTSUPP;
|
||||
return fscrypt_ioctl_get_key_status(filp, (void __user *)arg);
|
||||
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
if (!ext4_has_feature_encrypt(sb))
|
||||
return -EOPNOTSUPP;
|
||||
return fscrypt_ioctl_get_nonce(filp, (void __user *)arg);
|
||||
|
||||
case EXT4_IOC_FSGETXATTR:
|
||||
{
|
||||
struct fsxattr fa;
|
||||
|
@ -1297,6 +1302,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case FS_IOC_REMOVE_ENCRYPTION_KEY:
|
||||
case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
|
||||
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
case EXT4_IOC_SHUTDOWN:
|
||||
case FS_IOC_GETFSMAP:
|
||||
case FS_IOC_ENABLE_VERITY:
|
||||
|
|
|
@ -2444,6 +2444,14 @@ static int f2fs_ioc_get_encryption_key_status(struct file *filp,
|
|||
return fscrypt_ioctl_get_key_status(filp, (void __user *)arg);
|
||||
}
|
||||
|
||||
static int f2fs_ioc_get_encryption_nonce(struct file *filp, unsigned long arg)
|
||||
{
|
||||
if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp))))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return fscrypt_ioctl_get_nonce(filp, (void __user *)arg);
|
||||
}
|
||||
|
||||
static int f2fs_ioc_gc(struct file *filp, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
@ -3458,6 +3466,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
return f2fs_ioc_remove_encryption_key_all_users(filp, arg);
|
||||
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
|
||||
return f2fs_ioc_get_encryption_key_status(filp, arg);
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
return f2fs_ioc_get_encryption_nonce(filp, arg);
|
||||
case F2FS_IOC_GARBAGE_COLLECT:
|
||||
return f2fs_ioc_gc(filp, arg);
|
||||
case F2FS_IOC_GARBAGE_COLLECT_RANGE:
|
||||
|
@ -3631,6 +3641,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case FS_IOC_REMOVE_ENCRYPTION_KEY:
|
||||
case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
|
||||
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
case F2FS_IOC_GARBAGE_COLLECT:
|
||||
case F2FS_IOC_GARBAGE_COLLECT_RANGE:
|
||||
case F2FS_IOC_WRITE_CHECKPOINT:
|
||||
|
|
|
@ -229,6 +229,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
|
||||
return fscrypt_ioctl_get_key_status(file, (void __user *)arg);
|
||||
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
return fscrypt_ioctl_get_nonce(file, (void __user *)arg);
|
||||
|
||||
default:
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
@ -251,6 +254,7 @@ long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case FS_IOC_REMOVE_ENCRYPTION_KEY:
|
||||
case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
|
||||
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
|
||||
case FS_IOC_GET_ENCRYPTION_NONCE:
|
||||
break;
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
|
|
|
@ -919,6 +919,7 @@ gen_headers_out_arm = [
|
|||
"linux/usb/g_uvc.h",
|
||||
"linux/usb/gadgetfs.h",
|
||||
"linux/usb/midi.h",
|
||||
"linux/usb/raw_gadget.h",
|
||||
"linux/usb/tmc.h",
|
||||
"linux/usb/usb_ctrl_qti.h",
|
||||
"linux/usb/video.h",
|
||||
|
|
|
@ -913,6 +913,7 @@ gen_headers_out_arm64 = [
|
|||
"linux/usb/g_uvc.h",
|
||||
"linux/usb/gadgetfs.h",
|
||||
"linux/usb/midi.h",
|
||||
"linux/usb/raw_gadget.h",
|
||||
"linux/usb/tmc.h",
|
||||
"linux/usb/usb_ctrl_qti.h",
|
||||
"linux/usb/video.h",
|
||||
|
|
|
@ -646,10 +646,8 @@ struct request_queue {
|
|||
int bypass_depth;
|
||||
atomic_t mq_freeze_depth;
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_BSG)
|
||||
bsg_job_fn *bsg_job_fn;
|
||||
struct bsg_class_device bsg_dev;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_THROTTLING
|
||||
/* Throttle data */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
struct request;
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_BSG
|
||||
struct bsg_ops {
|
||||
int (*check_proto)(struct sg_io_v4 *hdr);
|
||||
int (*fill_hdr)(struct request *rq, struct sg_io_v4 *hdr,
|
||||
|
@ -22,6 +21,7 @@ struct bsg_class_device {
|
|||
const struct bsg_ops *ops;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_BSG
|
||||
int bsg_register_queue(struct request_queue *q, struct device *parent,
|
||||
const char *name, const struct bsg_ops *ops);
|
||||
int bsg_scsi_register_queue(struct request_queue *q, struct device *parent);
|
||||
|
|
|
@ -1908,6 +1908,7 @@ struct super_operations {
|
|||
void *(*clone_mnt_data) (void *);
|
||||
void (*copy_mnt_data) (void *, void *);
|
||||
void (*umount_begin) (struct super_block *);
|
||||
void (*umount_end)(struct super_block *sb, int flags);
|
||||
|
||||
int (*show_options)(struct seq_file *, struct dentry *);
|
||||
int (*show_options2)(struct vfsmount *,struct seq_file *, struct dentry *);
|
||||
|
|
|
@ -144,6 +144,7 @@ extern int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags);
|
|||
extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);
|
||||
extern int fscrypt_ioctl_get_policy(struct file *, void __user *);
|
||||
extern int fscrypt_ioctl_get_policy_ex(struct file *, void __user *);
|
||||
extern int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg);
|
||||
extern int fscrypt_has_permitted_context(struct inode *, struct inode *);
|
||||
extern int fscrypt_inherit_context(struct inode *, struct inode *,
|
||||
void *, bool);
|
||||
|
@ -302,6 +303,11 @@ static inline int fscrypt_ioctl_get_policy_ex(struct file *filp,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int fscrypt_has_permitted_context(struct inode *parent,
|
||||
struct inode *child)
|
||||
{
|
||||
|
|
|
@ -141,6 +141,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
|
|||
void __memblock_free_early(phys_addr_t base, phys_addr_t size);
|
||||
void __memblock_free_late(phys_addr_t base, phys_addr_t size);
|
||||
void create_pgtable_mapping(phys_addr_t start, phys_addr_t end);
|
||||
|
||||
/**
|
||||
* for_each_mem_range - iterate through memblock areas from type_a and not
|
||||
* included in type_b. Or just type_a if type_b is NULL.
|
||||
|
|
|
@ -166,6 +166,7 @@ struct fscrypt_get_key_status_arg {
|
|||
#define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
|
||||
#define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
|
||||
#define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
|
||||
#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
|
167
include/uapi/linux/usb/raw_gadget.h
Normal file
167
include/uapi/linux/usb/raw_gadget.h
Normal file
|
@ -0,0 +1,167 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* USB Raw Gadget driver.
|
||||
*
|
||||
* See Documentation/usb/raw-gadget.rst for more details.
|
||||
*/
|
||||
|
||||
#ifndef _UAPI__LINUX_USB_RAW_GADGET_H
|
||||
#define _UAPI__LINUX_USB_RAW_GADGET_H
|
||||
|
||||
#include <asm/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
|
||||
/* Maximum length of driver_name/device_name in the usb_raw_init struct. */
|
||||
#define UDC_NAME_LENGTH_MAX 128
|
||||
|
||||
/*
|
||||
* struct usb_raw_init - argument for USB_RAW_IOCTL_INIT ioctl.
|
||||
* @speed: The speed of the emulated USB device, takes the same values as
|
||||
* the usb_device_speed enum: USB_SPEED_FULL, USB_SPEED_HIGH, etc.
|
||||
* @driver_name: The name of the UDC driver.
|
||||
* @device_name: The name of a UDC instance.
|
||||
*
|
||||
* The last two fields identify a UDC the gadget driver should bind to.
|
||||
* For example, Dummy UDC has "dummy_udc" as its driver_name and "dummy_udc.N"
|
||||
* as its device_name, where N in the index of the Dummy UDC instance.
|
||||
* At the same time the dwc2 driver that is used on Raspberry Pi Zero, has
|
||||
* "20980000.usb" as both driver_name and device_name.
|
||||
*/
|
||||
struct usb_raw_init {
|
||||
__u8 driver_name[UDC_NAME_LENGTH_MAX];
|
||||
__u8 device_name[UDC_NAME_LENGTH_MAX];
|
||||
__u8 speed;
|
||||
};
|
||||
|
||||
/* The type of event fetched with the USB_RAW_IOCTL_EVENT_FETCH ioctl. */
|
||||
enum usb_raw_event_type {
|
||||
USB_RAW_EVENT_INVALID = 0,
|
||||
|
||||
/* This event is queued when the driver has bound to a UDC. */
|
||||
USB_RAW_EVENT_CONNECT = 1,
|
||||
|
||||
/* This event is queued when a new control request arrived to ep0. */
|
||||
USB_RAW_EVENT_CONTROL = 2,
|
||||
|
||||
/* The list might grow in the future. */
|
||||
};
|
||||
|
||||
/*
|
||||
* struct usb_raw_event - argument for USB_RAW_IOCTL_EVENT_FETCH ioctl.
|
||||
* @type: The type of the fetched event.
|
||||
* @length: Length of the data buffer. Updated by the driver and set to the
|
||||
* actual length of the fetched event data.
|
||||
* @data: A buffer to store the fetched event data.
|
||||
*
|
||||
* Currently the fetched data buffer is empty for USB_RAW_EVENT_CONNECT,
|
||||
* and contains struct usb_ctrlrequest for USB_RAW_EVENT_CONTROL.
|
||||
*/
|
||||
struct usb_raw_event {
|
||||
__u32 type;
|
||||
__u32 length;
|
||||
__u8 data[0];
|
||||
};
|
||||
|
||||
#define USB_RAW_IO_FLAGS_ZERO 0x0001
|
||||
#define USB_RAW_IO_FLAGS_MASK 0x0001
|
||||
|
||||
static inline int usb_raw_io_flags_valid(__u16 flags)
|
||||
{
|
||||
return (flags & ~USB_RAW_IO_FLAGS_MASK) == 0;
|
||||
}
|
||||
|
||||
static inline int usb_raw_io_flags_zero(__u16 flags)
|
||||
{
|
||||
return (flags & USB_RAW_IO_FLAGS_ZERO);
|
||||
}
|
||||
|
||||
/*
|
||||
* struct usb_raw_ep_io - argument for USB_RAW_IOCTL_EP0/EP_WRITE/READ ioctls.
|
||||
* @ep: Endpoint handle as returned by USB_RAW_IOCTL_EP_ENABLE for
|
||||
* USB_RAW_IOCTL_EP_WRITE/READ. Ignored for USB_RAW_IOCTL_EP0_WRITE/READ.
|
||||
* @flags: When USB_RAW_IO_FLAGS_ZERO is specified, the zero flag is set on
|
||||
* the submitted USB request, see include/linux/usb/gadget.h for details.
|
||||
* @length: Length of data.
|
||||
* @data: Data to send for USB_RAW_IOCTL_EP0/EP_WRITE. Buffer to store received
|
||||
* data for USB_RAW_IOCTL_EP0/EP_READ.
|
||||
*/
|
||||
struct usb_raw_ep_io {
|
||||
__u16 ep;
|
||||
__u16 flags;
|
||||
__u32 length;
|
||||
__u8 data[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Initializes a Raw Gadget instance.
|
||||
* Accepts a pointer to the usb_raw_init struct as an argument.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
|
||||
|
||||
/*
|
||||
* Instructs Raw Gadget to bind to a UDC and start emulating a USB device.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_RUN _IO('U', 1)
|
||||
|
||||
/*
|
||||
* A blocking ioctl that waits for an event and returns fetched event data to
|
||||
* the user.
|
||||
* Accepts a pointer to the usb_raw_event struct.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
|
||||
|
||||
/*
|
||||
* Queues an IN (OUT for READ) urb as a response to the last control request
|
||||
* received on endpoint 0, provided that was an IN (OUT for READ) request and
|
||||
* waits until the urb is completed. Copies received data to user for READ.
|
||||
* Accepts a pointer to the usb_raw_ep_io struct as an argument.
|
||||
* Returns length of trasferred data on success or negative error code on
|
||||
* failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
|
||||
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
|
||||
|
||||
/*
|
||||
* Finds an endpoint that supports the transfer type specified in the
|
||||
* descriptor and enables it.
|
||||
* Accepts a pointer to the usb_endpoint_descriptor struct as an argument.
|
||||
* Returns enabled endpoint handle on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
|
||||
|
||||
/* Disables specified endpoint.
|
||||
* Accepts endpoint handle as an argument.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
|
||||
|
||||
/*
|
||||
* Queues an IN (OUT for READ) urb as a response to the last control request
|
||||
* received on endpoint usb_raw_ep_io.ep, provided that was an IN (OUT for READ)
|
||||
* request and waits until the urb is completed. Copies received data to user
|
||||
* for READ.
|
||||
* Accepts a pointer to the usb_raw_ep_io struct as an argument.
|
||||
* Returns length of trasferred data on success or negative error code on
|
||||
* failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
|
||||
#define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
|
||||
|
||||
/*
|
||||
* Switches the gadget into the configured state.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
|
||||
|
||||
/*
|
||||
* Constrains UDC VBUS power usage.
|
||||
* Accepts current limit in 2 mA units as an argument.
|
||||
* Returns 0 on success or negative error code on failure.
|
||||
*/
|
||||
#define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
|
||||
|
||||
#endif /* _UAPI__LINUX_USB_RAW_GADGET_H */
|
Loading…
Reference in a new issue