···5656still doing productive work. As such, time spent in this subset of the5757stall state is tracked separately and exported in the "full" averages.58585959-The ratios are tracked as recent trends over ten, sixty, and three6060-hundred second windows, which gives insight into short term events as6161-well as medium and long term trends. The total absolute stall time is6262-tracked and exported as well, to allow detection of latency spikes6363-which wouldn't necessarily make a dent in the time averages, or to6464-average trends over custom time frames.5959+The ratios (in %) are tracked as recent trends over ten, sixty, and6060+three hundred second windows, which gives insight into short term events6161+as well as medium and long term trends. The total absolute stall time6262+(in us) is tracked and exported as well, to allow detection of latency6363+spikes which wouldn't necessarily make a dent in the time averages,6464+or to average trends over custom time frames.65656666Cgroup2 interface6767=================
···102102 dictionary which is empty, and that it will always be103103 invalid at this place.104104105105- 17 : bitstream version. If the first byte is 17, the next byte106106- gives the bitstream version (version 1 only). If the first byte107107- is not 17, the bitstream version is 0.105105+ 17 : bitstream version. If the first byte is 17, and compressed106106+ stream length is at least 5 bytes (length of shortest possible107107+ versioned bitstream), the next byte gives the bitstream version108108+ (version 1 only).109109+ Otherwise, the bitstream version is 0.108110109111 18..21 : copy 0..3 literals110112 state = (byte - 17) = 0..3 [ copy <state> literals ]
+4-3
MAINTAINERS
···18931893ARM/NUVOTON NPCM ARCHITECTURE18941894M: Avi Fishman <avifishman70@gmail.com>18951895M: Tomer Maimon <tmaimon77@gmail.com>18961896+M: Tali Perry <tali.perry1@gmail.com>18961897R: Patrick Venture <venture@google.com>18971898R: Nancy Yuen <yuenn@google.com>18981898-R: Brendan Higgins <brendanhiggins@google.com>18991899+R: Benjamin Fair <benjaminfair@google.com>18991900L: openbmc@lists.ozlabs.org (moderated for non-subscribers)19001901S: Supported19011902F: arch/arm/mach-npcm/19021903F: arch/arm/boot/dts/nuvoton-npcm*19031903-F: include/dt-bindings/clock/nuvoton,npcm7xx-clks.h19041904+F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h19041905F: drivers/*/*npcm*19051906F: Documentation/devicetree/bindings/*/*npcm*19061907F: Documentation/devicetree/bindings/*/*/*npcm*···75197518F: include/net/af_ieee802154.h75207519F: include/net/cfg802154.h75217520F: include/net/ieee802154_netdev.h75227522-F: Documentation/networking/ieee802154.txt75217521+F: Documentation/networking/ieee802154.rst7523752275247523IFE PROTOCOL75257524M: Yotam Gigi <yotam.gi@gmail.com>
···5555 */5656static inline void5757syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,5858- unsigned int i, unsigned int n, unsigned long *args)5858+ unsigned long *args)5959{6060 unsigned long *inside_ptregs = &(regs->r0);6161- inside_ptregs -= i;6262-6363- BUG_ON((i + n) > 6);6161+ unsigned int n = 6;6262+ unsigned int i = 0;64636564 while (n--) {6665 args[i++] = (*inside_ptregs);
···213213 gpio-sck = <&gpio0 5 GPIO_ACTIVE_HIGH>;214214 gpio-mosi = <&gpio0 4 GPIO_ACTIVE_HIGH>;215215 /*216216- * This chipselect is active high. Just setting the flags217217- * to GPIO_ACTIVE_HIGH is not enough for the SPI DT bindings,218218- * it will be ignored, only the special "spi-cs-high" flag219219- * really counts.216216+ * It's not actually active high, but the frameworks assume217217+ * the polarity of the passed-in GPIO is "normal" (active218218+ * high) then actively drives the line low to select the219219+ * chip.220220 */221221 cs-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;222222- spi-cs-high;223222 num-chipselects = <1>;224223225224 /*
+6-37
arch/arm/include/asm/syscall.h
···55555656static inline void syscall_get_arguments(struct task_struct *task,5757 struct pt_regs *regs,5858- unsigned int i, unsigned int n,5958 unsigned long *args)6059{6161- if (n == 0)6262- return;6060+ args[0] = regs->ARM_ORIG_r0;6161+ args++;63626464- if (i + n > SYSCALL_MAX_ARGS) {6565- unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;6666- unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;6767- pr_warn("%s called with max args %d, handling only %d\n",6868- __func__, i + n, SYSCALL_MAX_ARGS);6969- memset(args_bad, 0, n_bad * sizeof(args[0]));7070- n = SYSCALL_MAX_ARGS - i;7171- }7272-7373- if (i == 0) {7474- args[0] = regs->ARM_ORIG_r0;7575- args++;7676- i++;7777- n--;7878- }7979-8080- memcpy(args, ®s->ARM_r0 + i, n * sizeof(args[0]));6363+ memcpy(args, ®s->ARM_r0 + 1, 5 * sizeof(args[0]));8164}82658366static inline void syscall_set_arguments(struct task_struct *task,8467 struct pt_regs *regs,8585- unsigned int i, unsigned int n,8668 const unsigned long *args)8769{8888- if (n == 0)8989- return;7070+ regs->ARM_ORIG_r0 = args[0];7171+ args++;90729191- if (i + n > SYSCALL_MAX_ARGS) {9292- pr_warn("%s called with max args %d, handling only %d\n",9393- __func__, i + n, SYSCALL_MAX_ARGS);9494- n = SYSCALL_MAX_ARGS - i;9595- }9696-9797- if (i == 0) {9898- regs->ARM_ORIG_r0 = args[0];9999- args++;100100- i++;101101- n--;102102- }103103-104104- memcpy(®s->ARM_r0 + i, args, n * sizeof(args[0]));7373+ memcpy(®s->ARM_r0 + 1, args, 5 * sizeof(args[0]));10574}1067510776static inline int syscall_get_arch(void)
···65656666static inline void syscall_get_arguments(struct task_struct *task,6767 struct pt_regs *regs,6868- unsigned int i, unsigned int n,6968 unsigned long *args)7069{7171- if (n == 0)7272- return;7070+ args[0] = regs->orig_x0;7171+ args++;73727474- if (i + n > SYSCALL_MAX_ARGS) {7575- unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;7676- unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;7777- pr_warning("%s called with max args %d, handling only %d\n",7878- __func__, i + n, SYSCALL_MAX_ARGS);7979- memset(args_bad, 0, n_bad * sizeof(args[0]));8080- }8181-8282- if (i == 0) {8383- args[0] = regs->orig_x0;8484- args++;8585- i++;8686- n--;8787- }8888-8989- memcpy(args, ®s->regs[i], n * sizeof(args[0]));7373+ memcpy(args, ®s->regs[1], 5 * sizeof(args[0]));9074}91759276static inline void syscall_set_arguments(struct task_struct *task,9377 struct pt_regs *regs,9494- unsigned int i, unsigned int n,9578 const unsigned long *args)9679{9797- if (n == 0)9898- return;8080+ regs->orig_x0 = args[0];8181+ args++;9982100100- if (i + n > SYSCALL_MAX_ARGS) {101101- pr_warning("%s called with max args %d, handling only %d\n",102102- __func__, i + n, SYSCALL_MAX_ARGS);103103- n = SYSCALL_MAX_ARGS - i;104104- }105105-106106- if (i == 0) {107107- regs->orig_x0 = args[0];108108- args++;109109- i++;110110- n--;111111- }112112-113113- memcpy(®s->regs[i], args, n * sizeof(args[0]));8383+ memcpy(®s->regs[1], args, 5 * sizeof(args[0]));11484}1158511686/*
+6
arch/arm64/kernel/sdei.c
···9494 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr);9595 unsigned long high = low + SDEI_STACK_SIZE;96969797+ if (!low)9898+ return false;9999+97100 if (sp < low || sp >= high)98101 return false;99102···113110{114111 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr);115112 unsigned long high = low + SDEI_STACK_SIZE;113113+114114+ if (!low)115115+ return false;116116117117 if (sp < low || sp >= high)118118 return false;
+14-65
arch/c6x/include/asm/syscall.h
···4646}47474848static inline void syscall_get_arguments(struct task_struct *task,4949- struct pt_regs *regs, unsigned int i,5050- unsigned int n, unsigned long *args)4949+ struct pt_regs *regs,5050+ unsigned long *args)5151{5252- switch (i) {5353- case 0:5454- if (!n--)5555- break;5656- *args++ = regs->a4;5757- case 1:5858- if (!n--)5959- break;6060- *args++ = regs->b4;6161- case 2:6262- if (!n--)6363- break;6464- *args++ = regs->a6;6565- case 3:6666- if (!n--)6767- break;6868- *args++ = regs->b6;6969- case 4:7070- if (!n--)7171- break;7272- *args++ = regs->a8;7373- case 5:7474- if (!n--)7575- break;7676- *args++ = regs->b8;7777- case 6:7878- if (!n--)7979- break;8080- default:8181- BUG();8282- }5252+ *args++ = regs->a4;5353+ *args++ = regs->b4;5454+ *args++ = regs->a6;5555+ *args++ = regs->b6;5656+ *args++ = regs->a8;5757+ *args = regs->b8;8358}84598560static inline void syscall_set_arguments(struct task_struct *task,8661 struct pt_regs *regs,8787- unsigned int i, unsigned int n,8862 const unsigned long *args)8963{9090- switch (i) {9191- case 0:9292- if (!n--)9393- break;9494- regs->a4 = *args++;9595- case 1:9696- if (!n--)9797- break;9898- regs->b4 = *args++;9999- case 2:100100- if (!n--)101101- break;102102- regs->a6 = *args++;103103- case 3:104104- if (!n--)105105- break;106106- regs->b6 = *args++;107107- case 4:108108- if (!n--)109109- break;110110- regs->a8 = *args++;111111- case 5:112112- if (!n--)113113- break;114114- regs->a9 = *args++;115115- case 6:116116- if (!n)117117- break;118118- default:119119- BUG();120120- }6464+ regs->a4 = *args++;6565+ regs->b4 = *args++;6666+ regs->a6 = *args++;6767+ regs->b6 = *args++;6868+ regs->a8 = *args++;6969+ regs->a9 = *args;12170}1227112372#endif /* __ASM_C6X_SYSCALLS_H */
+8-18
arch/csky/include/asm/syscall.h
···43434444static inline void4545syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,4646- unsigned int i, unsigned int n, unsigned long *args)4646+ unsigned long *args)4747{4848- BUG_ON(i + n > 6);4949- if (i == 0) {5050- args[0] = regs->orig_a0;5151- args++;5252- i++;5353- n--;5454- }5555- memcpy(args, ®s->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));4848+ args[0] = regs->orig_a0;4949+ args++;5050+ memcpy(args, ®s->a1, 5 * sizeof(args[0]));5651}57525853static inline void5954syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,6060- unsigned int i, unsigned int n, const unsigned long *args)5555+ const unsigned long *args)6156{6262- BUG_ON(i + n > 6);6363- if (i == 0) {6464- regs->orig_a0 = args[0];6565- args++;6666- i++;6767- n--;6868- }6969- memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));5757+ regs->orig_a0 = args[0];5858+ args++;5959+ memcpy(®s->a1, args, 5 * sizeof(regs->a1));7060}71617262static inline int
+7-27
arch/h8300/include/asm/syscall.h
···17171818static inline void1919syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,2020- unsigned int i, unsigned int n, unsigned long *args)2020+ unsigned long *args)2121{2222- BUG_ON(i + n > 6);2323-2424- while (n > 0) {2525- switch (i) {2626- case 0:2727- *args++ = regs->er1;2828- break;2929- case 1:3030- *args++ = regs->er2;3131- break;3232- case 2:3333- *args++ = regs->er3;3434- break;3535- case 3:3636- *args++ = regs->er4;3737- break;3838- case 4:3939- *args++ = regs->er5;4040- break;4141- case 5:4242- *args++ = regs->er6;4343- break;4444- }4545- i++;4646- n--;4747- }2222+ *args++ = regs->er1;2323+ *args++ = regs->er2;2424+ *args++ = regs->er3;2525+ *args++ = regs->er4;2626+ *args++ = regs->er5;2727+ *args = regs->er6;4828}49295030
+1-3
arch/hexagon/include/asm/syscall.h
···37373838static inline void syscall_get_arguments(struct task_struct *task,3939 struct pt_regs *regs,4040- unsigned int i, unsigned int n,4140 unsigned long *args)4241{4343- BUG_ON(i + n > 6);4444- memcpy(args, &(®s->r00)[i], n * sizeof(args[0]));4242+ memcpy(args, &(®s->r00)[0], 6 * sizeof(args[0]));4543}4644#endif
+3-10
arch/ia64/include/asm/syscall.h
···5959}60606161extern void ia64_syscall_get_set_arguments(struct task_struct *task,6262- struct pt_regs *regs, unsigned int i, unsigned int n,6363- unsigned long *args, int rw);6262+ struct pt_regs *regs, unsigned long *args, int rw);6463static inline void syscall_get_arguments(struct task_struct *task,6564 struct pt_regs *regs,6666- unsigned int i, unsigned int n,6765 unsigned long *args)6866{6969- BUG_ON(i + n > 6);7070-7171- ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);6767+ ia64_syscall_get_set_arguments(task, regs, args, 0);7268}73697470static inline void syscall_set_arguments(struct task_struct *task,7571 struct pt_regs *regs,7676- unsigned int i, unsigned int n,7772 unsigned long *args)7873{7979- BUG_ON(i + n > 6);8080-8181- ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);7474+ ia64_syscall_get_set_arguments(task, regs, args, 1);8275}83768477static inline int syscall_get_arch(void)
+3-4
arch/ia64/kernel/ptrace.c
···21792179}2180218021812181void ia64_syscall_get_set_arguments(struct task_struct *task,21822182- struct pt_regs *regs, unsigned int i, unsigned int n,21832183- unsigned long *args, int rw)21822182+ struct pt_regs *regs, unsigned long *args, int rw)21842183{21852184 struct syscall_get_set_args data = {21862186- .i = i,21872187- .n = n,21852185+ .i = 0,21862186+ .n = 6,21882187 .args = args,21892188 .regs = regs,21902189 .rw = rw,
+6-2
arch/microblaze/include/asm/syscall.h
···82828383static inline void syscall_get_arguments(struct task_struct *task,8484 struct pt_regs *regs,8585- unsigned int i, unsigned int n,8685 unsigned long *args)8786{8787+ unsigned int i = 0;8888+ unsigned int n = 6;8989+8890 while (n--)8991 *args++ = microblaze_get_syscall_arg(regs, i++);9092}91939294static inline void syscall_set_arguments(struct task_struct *task,9395 struct pt_regs *regs,9494- unsigned int i, unsigned int n,9596 const unsigned long *args)9697{9898+ unsigned int i = 0;9999+ unsigned int n = 6;100100+97101 while (n--)98102 microblaze_set_syscall_arg(regs, i++, *args++);99103}
+2-1
arch/mips/include/asm/syscall.h
···116116117117static inline void syscall_get_arguments(struct task_struct *task,118118 struct pt_regs *regs,119119- unsigned int i, unsigned int n,120119 unsigned long *args)121120{121121+ unsigned int i = 0;122122+ unsigned int n = 6;122123 int ret;123124124125 /* O32 ABI syscall() */
+1-1
arch/mips/kernel/ptrace.c
···1419141914201420 sd.nr = syscall;14211421 sd.arch = syscall_get_arch();14221422- syscall_get_arguments(current, regs, 0, 6, args);14221422+ syscall_get_arguments(current, regs, args);14231423 for (i = 0; i < 6; i++)14241424 sd.args[i] = args[i];14251425 sd.instruction_pointer = KSTK_EIP(current);
+11-51
arch/nds32/include/asm/syscall.h
···108108 * syscall_get_arguments - extract system call parameter values109109 * @task: task of interest, must be blocked110110 * @regs: task_pt_regs() of @task111111- * @i: argument index [0,5]112112- * @n: number of arguments; n+i must be [1,6].113111 * @args: array filled with argument values114112 *115115- * Fetches @n arguments to the system call starting with the @i'th argument116116- * (from 0 through 5). Argument @i is stored in @args[0], and so on.117117- * An arch inline version is probably optimal when @i and @n are constants.113113+ * Fetches 6 arguments to the system call (from 0 through 5). The first114114+ * argument is stored in @args[0], and so on.118115 *119116 * It's only valid to call this when @task is stopped for tracing on120117 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.121121- * It's invalid to call this with @i + @n > 6; we only support system calls122122- * taking up to 6 arguments.123118 */124119#define SYSCALL_MAX_ARGS 6125120void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,126126- unsigned int i, unsigned int n, unsigned long *args)121121+ unsigned long *args)127122{128128- if (n == 0)129129- return;130130- if (i + n > SYSCALL_MAX_ARGS) {131131- unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;132132- unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;133133- pr_warning("%s called with max args %d, handling only %d\n",134134- __func__, i + n, SYSCALL_MAX_ARGS);135135- memset(args_bad, 0, n_bad * sizeof(args[0]));136136- memset(args_bad, 0, n_bad * sizeof(args[0]));137137- }138138-139139- if (i == 0) {140140- args[0] = regs->orig_r0;141141- args++;142142- i++;143143- n--;144144- }145145-146146- memcpy(args, ®s->uregs[0] + i, n * sizeof(args[0]));123123+ args[0] = regs->orig_r0;124124+ args++;125125+ memcpy(args, ®s->uregs[0] + 1, 5 * sizeof(args[0]));147126}148127149128/**150129 * syscall_set_arguments - change system call parameter value151130 * @task: task of interest, must be in system call entry tracing152131 * @regs: task_pt_regs() of @task153153- * @i: argument index [0,5]154154- * @n: number of arguments; n+i must be [1,6].155132 * @args: array of argument values to store156133 *157157- * Changes @n arguments to the system call starting with the @i'th argument.158158- * Argument @i gets value @args[0], and so on.159159- * An arch inline version is probably optimal when @i and @n are constants.134134+ * Changes 6 arguments to the system call. The first argument gets value135135+ * @args[0], and so on.160136 *161137 * It's only valid to call this when @task is stopped for tracing on162138 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.163163- * It's invalid to call this with @i + @n > 6; we only support system calls164164- * taking up to 6 arguments.165139 */166140void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,167167- unsigned int i, unsigned int n,168141 const unsigned long *args)169142{170170- if (n == 0)171171- return;143143+ regs->orig_r0 = args[0];144144+ args++;172145173173- if (i + n > SYSCALL_MAX_ARGS) {174174- pr_warn("%s called with max args %d, handling only %d\n",175175- __func__, i + n, SYSCALL_MAX_ARGS);176176- n = SYSCALL_MAX_ARGS - i;177177- }178178-179179- if (i == 0) {180180- regs->orig_r0 = args[0];181181- args++;182182- i++;183183- n--;184184- }185185-186186- memcpy(®s->uregs[0] + i, args, n * sizeof(args[0]));146146+ memcpy(®s->uregs[0] + 1, args, 5 * sizeof(args[0]));187147}188148#endif /* _ASM_NDS32_SYSCALL_H */
+14-70
arch/nios2/include/asm/syscall.h
···5858}59596060static inline void syscall_get_arguments(struct task_struct *task,6161- struct pt_regs *regs, unsigned int i, unsigned int n,6262- unsigned long *args)6161+ struct pt_regs *regs, unsigned long *args)6362{6464- BUG_ON(i + n > 6);6565-6666- switch (i) {6767- case 0:6868- if (!n--)6969- break;7070- *args++ = regs->r4;7171- case 1:7272- if (!n--)7373- break;7474- *args++ = regs->r5;7575- case 2:7676- if (!n--)7777- break;7878- *args++ = regs->r6;7979- case 3:8080- if (!n--)8181- break;8282- *args++ = regs->r7;8383- case 4:8484- if (!n--)8585- break;8686- *args++ = regs->r8;8787- case 5:8888- if (!n--)8989- break;9090- *args++ = regs->r9;9191- case 6:9292- if (!n--)9393- break;9494- default:9595- BUG();9696- }6363+ *args++ = regs->r4;6464+ *args++ = regs->r5;6565+ *args++ = regs->r6;6666+ *args++ = regs->r7;6767+ *args++ = regs->r8;6868+ *args = regs->r9;9769}98709971static inline void syscall_set_arguments(struct task_struct *task,100100- struct pt_regs *regs, unsigned int i, unsigned int n,101101- const unsigned long *args)7272+ struct pt_regs *regs, const unsigned long *args)10273{103103- BUG_ON(i + n > 6);104104-105105- switch (i) {106106- case 0:107107- if (!n--)108108- break;109109- regs->r4 = *args++;110110- case 1:111111- if (!n--)112112- break;113113- regs->r5 = *args++;114114- case 2:115115- if (!n--)116116- break;117117- regs->r6 = *args++;118118- case 3:119119- if (!n--)120120- break;121121- regs->r7 = *args++;122122- case 4:123123- if (!n--)124124- break;125125- regs->r8 = *args++;126126- case 5:127127- if (!n--)128128- break;129129- regs->r9 = *args++;130130- case 6:131131- if (!n)132132- break;133133- default:134134- BUG();135135- }7474+ regs->r4 = *args++;7575+ regs->r5 = *args++;7676+ regs->r6 = *args++;7777+ regs->r7 = *args++;7878+ regs->r8 = *args++;7979+ regs->r9 = *args;13680}1378113882#endif
+4-8
arch/openrisc/include/asm/syscall.h
···56565757static inline void5858syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,5959- unsigned int i, unsigned int n, unsigned long *args)5959+ unsigned long *args)6060{6161- BUG_ON(i + n > 6);6262-6363- memcpy(args, ®s->gpr[3 + i], n * sizeof(args[0]));6161+ memcpy(args, ®s->gpr[3], 6 * sizeof(args[0]));6462}65636664static inline void6765syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,6868- unsigned int i, unsigned int n, const unsigned long *args)6666+ const unsigned long *args)6967{7070- BUG_ON(i + n > 6);7171-7272- memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));6868+ memcpy(®s->gpr[3], args, 6 * sizeof(args[0]));7369}74707571static inline int syscall_get_arch(void)
+3-2
arch/parisc/include/asm/ptrace.h
···22222323static inline unsigned long regs_return_value(struct pt_regs *regs)2424{2525- return regs->gr[20];2525+ return regs->gr[28];2626}27272828static inline void instruction_pointer_set(struct pt_regs *regs,2929 unsigned long val)3030{3131- regs->iaoq[0] = val;3131+ regs->iaoq[0] = val;3232+ regs->iaoq[1] = val + 4;3233}33343435/* Query offset/name of register from its name/offset */
+8-22
arch/parisc/include/asm/syscall.h
···1818}19192020static inline void syscall_get_arguments(struct task_struct *tsk,2121- struct pt_regs *regs, unsigned int i,2222- unsigned int n, unsigned long *args)2121+ struct pt_regs *regs,2222+ unsigned long *args)2323{2424- BUG_ON(i);2525-2626- switch (n) {2727- case 6:2828- args[5] = regs->gr[21];2929- case 5:3030- args[4] = regs->gr[22];3131- case 4:3232- args[3] = regs->gr[23];3333- case 3:3434- args[2] = regs->gr[24];3535- case 2:3636- args[1] = regs->gr[25];3737- case 1:3838- args[0] = regs->gr[26];3939- case 0:4040- break;4141- default:4242- BUG();4343- }2424+ args[5] = regs->gr[21];2525+ args[4] = regs->gr[22];2626+ args[3] = regs->gr[23];2727+ args[2] = regs->gr[24];2828+ args[1] = regs->gr[25];2929+ args[0] = regs->gr[26];4430}45314632static inline long syscall_get_return_value(struct task_struct *task,
-6
arch/parisc/kernel/process.c
···210210211211static int __init parisc_idle_init(void)212212{213213- const char *marker;214214-215215- /* check QEMU/SeaBIOS marker in PAGE0 */216216- marker = (char *) &PAGE0->pad0;217217- running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0);218218-219213 if (!running_on_qemu)220214 cpu_idle_poll_ctrl(1);221215
···65656666static inline void syscall_get_arguments(struct task_struct *task,6767 struct pt_regs *regs,6868- unsigned int i, unsigned int n,6968 unsigned long *args)7069{7170 unsigned long val, mask = -1UL;7272-7373- BUG_ON(i + n > 6);7171+ unsigned int n = 6;74727573#ifdef CONFIG_COMPAT7674 if (test_tsk_thread_flag(task, TIF_32BIT))7775 mask = 0xffffffff;7876#endif7977 while (n--) {8080- if (n == 0 && i == 0)7878+ if (n == 0)8179 val = regs->orig_gpr3;8280 else8383- val = regs->gpr[3 + i + n];8181+ val = regs->gpr[3 + n];84828583 args[n] = val & mask;8684 }···86888789static inline void syscall_set_arguments(struct task_struct *task,8890 struct pt_regs *regs,8989- unsigned int i, unsigned int n,9091 const unsigned long *args)9192{9292- BUG_ON(i + n > 6);9393- memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));9393+ memcpy(®s->gpr[3], args, 6 * sizeof(args[0]));94949595 /* Also copy the first argument into orig_gpr3 */9696- if (i == 0 && n > 0)9797- regs->orig_gpr3 = args[0];9696+ regs->orig_gpr3 = args[0];9897}999810099static inline int syscall_get_arch(void)
+7
arch/powerpc/kernel/kvm.c
···2222#include <linux/kvm_host.h>2323#include <linux/init.h>2424#include <linux/export.h>2525+#include <linux/kmemleak.h>2526#include <linux/kvm_para.h>2627#include <linux/slab.h>2728#include <linux/of.h>···713712714713static __init void kvm_free_tmp(void)715714{715715+ /*716716+ * Inform kmemleak about the hole in the .bss section since the717717+ * corresponding pages will be unmapped with DEBUG_PAGEALLOC=y.718718+ */719719+ kmemleak_free_part(&kvm_tmp[kvm_tmp_index],720720+ ARRAY_SIZE(kvm_tmp) - kvm_tmp_index);716721 free_reserved_area(&kvm_tmp[kvm_tmp_index],717722 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);718723}
+6-18
arch/riscv/include/asm/syscall.h
···72727373static inline void syscall_get_arguments(struct task_struct *task,7474 struct pt_regs *regs,7575- unsigned int i, unsigned int n,7675 unsigned long *args)7776{7878- BUG_ON(i + n > 6);7979- if (i == 0) {8080- args[0] = regs->orig_a0;8181- args++;8282- i++;8383- n--;8484- }8585- memcpy(args, ®s->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));7777+ args[0] = regs->orig_a0;7878+ args++;7979+ memcpy(args, ®s->a1, 5 * sizeof(args[0]));8680}87818882static inline void syscall_set_arguments(struct task_struct *task,8983 struct pt_regs *regs,9090- unsigned int i, unsigned int n,9184 const unsigned long *args)9285{9393- BUG_ON(i + n > 6);9494- if (i == 0) {9595- regs->orig_a0 = args[0];9696- args++;9797- i++;9898- n--;9999- }100100- memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));8686+ regs->orig_a0 = args[0];8787+ args++;8888+ memcpy(®s->a1, args, 5 * sizeof(regs->a1));10189}1029010391static inline int syscall_get_arch(void)
+10-18
arch/s390/include/asm/syscall.h
···56565757static inline void syscall_get_arguments(struct task_struct *task,5858 struct pt_regs *regs,5959- unsigned int i, unsigned int n,6059 unsigned long *args)6160{6261 unsigned long mask = -1UL;6262+ unsigned int n = 6;63636464- /*6565- * No arguments for this syscall, there's nothing to do.6666- */6767- if (!n)6868- return;6969-7070- BUG_ON(i + n > 6);7164#ifdef CONFIG_COMPAT7265 if (test_tsk_thread_flag(task, TIF_31BIT))7366 mask = 0xffffffff;7467#endif7568 while (n-- > 0)7676- if (i + n > 0)7777- args[n] = regs->gprs[2 + i + n] & mask;7878- if (i == 0)7979- args[0] = regs->orig_gpr2 & mask;6969+ if (n > 0)7070+ args[n] = regs->gprs[2 + n] & mask;7171+7272+ args[0] = regs->orig_gpr2 & mask;8073}81748275static inline void syscall_set_arguments(struct task_struct *task,8376 struct pt_regs *regs,8484- unsigned int i, unsigned int n,8577 const unsigned long *args)8678{8787- BUG_ON(i + n > 6);7979+ unsigned int n = 6;8080+8881 while (n-- > 0)8989- if (i + n > 0)9090- regs->gprs[2 + i + n] = args[n];9191- if (i == 0)9292- regs->orig_gpr2 = args[0];8282+ if (n > 0)8383+ regs->gprs[2 + n] = args[n];8484+ regs->orig_gpr2 = args[0];9385}94869587static inline int syscall_get_arch(void)
+2-2
arch/sh/boards/of-generic.c
···164164165165struct sh_clk_ops;166166167167-void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)167167+void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx)168168{169169}170170171171-void __init plat_irq_setup(void)171171+void __init __weak plat_irq_setup(void)172172{173173}
+12-35
arch/sh/include/asm/syscall_32.h
···48484949static inline void syscall_get_arguments(struct task_struct *task,5050 struct pt_regs *regs,5151- unsigned int i, unsigned int n,5251 unsigned long *args)5352{5454- /*5555- * Do this simply for now. If we need to start supporting5656- * fetching arguments from arbitrary indices, this will need some5757- * extra logic. Presently there are no in-tree users that depend5858- * on this behaviour.5959- */6060- BUG_ON(i);61536254 /* Argument pattern is: R4, R5, R6, R7, R0, R1 */6363- switch (n) {6464- case 6: args[5] = regs->regs[1];6565- case 5: args[4] = regs->regs[0];6666- case 4: args[3] = regs->regs[7];6767- case 3: args[2] = regs->regs[6];6868- case 2: args[1] = regs->regs[5];6969- case 1: args[0] = regs->regs[4];7070- case 0:7171- break;7272- default:7373- BUG();7474- }5555+ args[5] = regs->regs[1];5656+ args[4] = regs->regs[0];5757+ args[3] = regs->regs[7];5858+ args[2] = regs->regs[6];5959+ args[1] = regs->regs[5];6060+ args[0] = regs->regs[4];7561}76627763static inline void syscall_set_arguments(struct task_struct *task,7864 struct pt_regs *regs,7979- unsigned int i, unsigned int n,8065 const unsigned long *args)8166{8282- /* Same note as above applies */8383- BUG_ON(i);8484-8585- switch (n) {8686- case 6: regs->regs[1] = args[5];8787- case 5: regs->regs[0] = args[4];8888- case 4: regs->regs[7] = args[3];8989- case 3: regs->regs[6] = args[2];9090- case 2: regs->regs[5] = args[1];9191- case 1: regs->regs[4] = args[0];9292- break;9393- default:9494- BUG();9595- }6767+ regs->regs[1] = args[5];6868+ regs->regs[0] = args[4];6969+ regs->regs[7] = args[3];7070+ regs->regs[6] = args[2];7171+ regs->regs[5] = args[1];7272+ regs->regs[4] = args[0];9673}97749875static inline int syscall_get_arch(void)
+2-6
arch/sh/include/asm/syscall_64.h
···47474848static inline void syscall_get_arguments(struct task_struct *task,4949 struct pt_regs *regs,5050- unsigned int i, unsigned int n,5150 unsigned long *args)5251{5353- BUG_ON(i + n > 6);5454- memcpy(args, ®s->regs[2 + i], n * sizeof(args[0]));5252+ memcpy(args, ®s->regs[2], 6 * sizeof(args[0]));5553}56545755static inline void syscall_set_arguments(struct task_struct *task,5856 struct pt_regs *regs,5959- unsigned int i, unsigned int n,6057 const unsigned long *args)6158{6262- BUG_ON(i + n > 6);6363- memcpy(®s->regs[2 + i], args, n * sizeof(args[0]));5959+ memcpy(®s->regs[2], args, 6 * sizeof(args[0]));6460}65616662static inline int syscall_get_arch(void)
+5-6
arch/sparc/include/asm/syscall.h
···96969797static inline void syscall_get_arguments(struct task_struct *task,9898 struct pt_regs *regs,9999- unsigned int i, unsigned int n,10099 unsigned long *args)101100{102101 int zero_extend = 0;103102 unsigned int j;103103+ unsigned int n = 6;104104105105#ifdef CONFIG_SPARC64106106 if (test_tsk_thread_flag(task, TIF_32BIT))···108108#endif109109110110 for (j = 0; j < n; j++) {111111- unsigned long val = regs->u_regs[UREG_I0 + i + j];111111+ unsigned long val = regs->u_regs[UREG_I0 + j];112112113113 if (zero_extend)114114 args[j] = (u32) val;···119119120120static inline void syscall_set_arguments(struct task_struct *task,121121 struct pt_regs *regs,122122- unsigned int i, unsigned int n,123122 const unsigned long *args)124123{125125- unsigned int j;124124+ unsigned int i;126125127127- for (j = 0; j < n; j++)128128- regs->u_regs[UREG_I0 + i + j] = args[j];126126+ for (i = 0; i < 6; i++)127127+ regs->u_regs[UREG_I0 + i] = args[i];129128}130129131130static inline int syscall_get_arch(void)
+12-66
arch/um/include/asm/syscall-generic.h
···53535454static inline void syscall_get_arguments(struct task_struct *task,5555 struct pt_regs *regs,5656- unsigned int i, unsigned int n,5756 unsigned long *args)5857{5958 const struct uml_pt_regs *r = ®s->regs;60596161- switch (i) {6262- case 0:6363- if (!n--)6464- break;6565- *args++ = UPT_SYSCALL_ARG1(r);6666- case 1:6767- if (!n--)6868- break;6969- *args++ = UPT_SYSCALL_ARG2(r);7070- case 2:7171- if (!n--)7272- break;7373- *args++ = UPT_SYSCALL_ARG3(r);7474- case 3:7575- if (!n--)7676- break;7777- *args++ = UPT_SYSCALL_ARG4(r);7878- case 4:7979- if (!n--)8080- break;8181- *args++ = UPT_SYSCALL_ARG5(r);8282- case 5:8383- if (!n--)8484- break;8585- *args++ = UPT_SYSCALL_ARG6(r);8686- case 6:8787- if (!n--)8888- break;8989- default:9090- BUG();9191- break;9292- }6060+ *args++ = UPT_SYSCALL_ARG1(r);6161+ *args++ = UPT_SYSCALL_ARG2(r);6262+ *args++ = UPT_SYSCALL_ARG3(r);6363+ *args++ = UPT_SYSCALL_ARG4(r);6464+ *args++ = UPT_SYSCALL_ARG5(r);6565+ *args = UPT_SYSCALL_ARG6(r);9366}94679568static inline void syscall_set_arguments(struct task_struct *task,9669 struct pt_regs *regs,9797- unsigned int i, unsigned int n,9870 const unsigned long *args)9971{10072 struct uml_pt_regs *r = ®s->regs;10173102102- switch (i) {103103- case 0:104104- if (!n--)105105- break;106106- UPT_SYSCALL_ARG1(r) = *args++;107107- case 1:108108- if (!n--)109109- break;110110- UPT_SYSCALL_ARG2(r) = *args++;111111- case 2:112112- if (!n--)113113- break;114114- UPT_SYSCALL_ARG3(r) = *args++;115115- case 3:116116- if (!n--)117117- break;118118- UPT_SYSCALL_ARG4(r) = *args++;119119- case 4:120120- if (!n--)121121- break;122122- UPT_SYSCALL_ARG5(r) = *args++;123123- case 5:124124- if (!n--)125125- break;126126- UPT_SYSCALL_ARG6(r) = *args++;127127- case 6:128128- if (!n--)129129- break;130130- default:131131- BUG();132132- break;133133- }7474+ UPT_SYSCALL_ARG1(r) = *args++;7575+ UPT_SYSCALL_ARG2(r) = *args++;7676+ UPT_SYSCALL_ARG3(r) = *args++;7777+ UPT_SYSCALL_ARG4(r) = *args++;7878+ UPT_SYSCALL_ARG5(r) = *args++;7979+ UPT_SYSCALL_ARG6(r) = *args;13480}1358113682/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
+33-109
arch/x86/include/asm/syscall.h
···91919292static inline void syscall_get_arguments(struct task_struct *task,9393 struct pt_regs *regs,9494- unsigned int i, unsigned int n,9594 unsigned long *args)9695{9797- BUG_ON(i + n > 6);9898- memcpy(args, ®s->bx + i, n * sizeof(args[0]));9696+ memcpy(args, ®s->bx, 6 * sizeof(args[0]));9997}1009810199static inline void syscall_set_arguments(struct task_struct *task,···114116115117static inline void syscall_get_arguments(struct task_struct *task,116118 struct pt_regs *regs,117117- unsigned int i, unsigned int n,118119 unsigned long *args)119120{120121# ifdef CONFIG_IA32_EMULATION121121- if (task->thread_info.status & TS_COMPAT)122122- switch (i) {123123- case 0:124124- if (!n--) break;125125- *args++ = regs->bx;126126- case 1:127127- if (!n--) break;128128- *args++ = regs->cx;129129- case 2:130130- if (!n--) break;131131- *args++ = regs->dx;132132- case 3:133133- if (!n--) break;134134- *args++ = regs->si;135135- case 4:136136- if (!n--) break;137137- *args++ = regs->di;138138- case 5:139139- if (!n--) break;140140- *args++ = regs->bp;141141- case 6:142142- if (!n--) break;143143- default:144144- BUG();145145- break;146146- }147147- else122122+ if (task->thread_info.status & TS_COMPAT) {123123+ *args++ = regs->bx;124124+ *args++ = regs->cx;125125+ *args++ = regs->dx;126126+ *args++ = regs->si;127127+ *args++ = regs->di;128128+ *args = regs->bp;129129+ } else148130# endif149149- switch (i) {150150- case 0:151151- if (!n--) break;152152- *args++ = regs->di;153153- case 1:154154- if (!n--) break;155155- *args++ = regs->si;156156- case 2:157157- if (!n--) break;158158- *args++ = regs->dx;159159- case 3:160160- if (!n--) break;161161- *args++ = regs->r10;162162- case 4:163163- if (!n--) break;164164- *args++ = regs->r8;165165- case 5:166166- if (!n--) break;167167- *args++ = regs->r9;168168- case 6:169169- if (!n--) break;170170- default:171171- BUG();172172- break;173173- }131131+ {132132+ *args++ = regs->di;133133+ *args++ = regs->si;134134+ *args++ = regs->dx;135135+ *args++ = regs->r10;136136+ *args++ = regs->r8;137137+ *args = regs->r9;138138+ }174139}175140176141static inline void syscall_set_arguments(struct task_struct *task,177142 struct pt_regs *regs,178178- unsigned int i, unsigned int n,179143 const unsigned long *args)180144{181145# ifdef CONFIG_IA32_EMULATION182182- if (task->thread_info.status & TS_COMPAT)183183- switch (i) {184184- case 0:185185- if (!n--) break;186186- regs->bx = *args++;187187- case 1:188188- if (!n--) break;189189- regs->cx = *args++;190190- case 2:191191- if (!n--) break;192192- regs->dx = *args++;193193- case 3:194194- if (!n--) break;195195- regs->si = *args++;196196- case 4:197197- if (!n--) break;198198- regs->di = *args++;199199- case 5:200200- if (!n--) break;201201- regs->bp = *args++;202202- case 6:203203- if (!n--) break;204204- default:205205- BUG();206206- break;207207- }208208- else146146+ if (task->thread_info.status & TS_COMPAT) {147147+ regs->bx = *args++;148148+ regs->cx = *args++;149149+ regs->dx = *args++;150150+ regs->si = *args++;151151+ regs->di = *args++;152152+ regs->bp = *args;153153+ } else209154# endif210210- switch (i) {211211- case 0:212212- if (!n--) break;213213- regs->di = *args++;214214- case 1:215215- if (!n--) break;216216- regs->si = *args++;217217- case 2:218218- if (!n--) break;219219- regs->dx = *args++;220220- case 3:221221- if (!n--) break;222222- regs->r10 = *args++;223223- case 4:224224- if (!n--) break;225225- regs->r8 = *args++;226226- case 5:227227- if (!n--) break;228228- regs->r9 = *args++;229229- case 6:230230- if (!n--) break;231231- default:232232- BUG();233233- break;234234- }155155+ {156156+ regs->di = *args++;157157+ regs->si = *args++;158158+ regs->dx = *args++;159159+ regs->r10 = *args++;160160+ regs->r8 = *args++;161161+ regs->r9 = *args;162162+ }235163}236164237165static inline int syscall_get_arch(void)
···64226422 return ret;64236423}6424642464256425-static int get_num_contig_pages(int idx, struct page **inpages,64266426- unsigned long npages)64256425+static unsigned long get_num_contig_pages(unsigned long idx,64266426+ struct page **inpages, unsigned long npages)64276427{64286428 unsigned long paddr, next_paddr;64296429- int i = idx + 1, pages = 1;64296429+ unsigned long i = idx + 1, pages = 1;6430643064316431 /* find the number of contiguous pages starting from idx */64326432 paddr = __sme_page_pa(inpages[idx]);···6445644564466446static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)64476447{64486448- unsigned long vaddr, vaddr_end, next_vaddr, npages, size;64486448+ unsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i;64496449 struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;64506450 struct kvm_sev_launch_update_data params;64516451 struct sev_data_launch_update_data *data;64526452 struct page **inpages;64536453- int i, ret, pages;64536453+ int ret;6454645464556455 if (!sev_guest(kvm))64566456 return -ENOTTY;···67996799 struct page **src_p, **dst_p;68006800 struct kvm_sev_dbg debug;68016801 unsigned long n;68026802- int ret, size;68026802+ unsigned int size;68036803+ int ret;6803680468046805 if (!sev_guest(kvm))68056806 return -ENOTTY;6806680768076808 if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))68086809 return -EFAULT;68106810+68116811+ if (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)68126812+ return -EINVAL;68136813+ if (!debug.dst_uaddr)68146814+ return -EINVAL;6809681568106816 vaddr = debug.src_uaddr;68116817 size = debug.len;···68636857 dst_vaddr,68646858 len, &argp->error);6865685968666866- sev_unpin_memory(kvm, src_p, 1);68676867- sev_unpin_memory(kvm, dst_p, 1);68606860+ sev_unpin_memory(kvm, src_p, n);68616861+ sev_unpin_memory(kvm, dst_p, n);6868686268696863 if (ret)68706864 goto err;
+45-29
arch/x86/kvm/vmx/nested.c
···500500 }501501}502502503503+static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) {504504+ int msr;505505+506506+ for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {507507+ unsigned word = msr / BITS_PER_LONG;508508+509509+ msr_bitmap[word] = ~0;510510+ msr_bitmap[word + (0x800 / sizeof(long))] = ~0;511511+ }512512+}513513+503514/*504515 * Merge L0's and L1's MSR bitmap, return false to indicate that505516 * we do not use the hardware.···552541 return false;553542554543 msr_bitmap_l1 = (unsigned long *)kmap(page);555555- if (nested_cpu_has_apic_reg_virt(vmcs12)) {556556- /*557557- * L0 need not intercept reads for MSRs between 0x800 and 0x8ff, it558558- * just lets the processor take the value from the virtual-APIC page;559559- * take those 256 bits directly from the L1 bitmap.560560- */561561- for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {562562- unsigned word = msr / BITS_PER_LONG;563563- msr_bitmap_l0[word] = msr_bitmap_l1[word];564564- msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;565565- }566566- } else {567567- for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {568568- unsigned word = msr / BITS_PER_LONG;569569- msr_bitmap_l0[word] = ~0;570570- msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;571571- }572572- }573544574574- nested_vmx_disable_intercept_for_msr(575575- msr_bitmap_l1, msr_bitmap_l0,576576- X2APIC_MSR(APIC_TASKPRI),577577- MSR_TYPE_W);545545+ /*546546+ * To keep the control flow simple, pay eight 8-byte writes (sixteen547547+ * 4-byte writes on 32-bit systems) up front to enable intercepts for548548+ * the x2APIC MSR range and selectively disable them below.549549+ */550550+ enable_x2apic_msr_intercepts(msr_bitmap_l0);578551579579- if (nested_cpu_has_vid(vmcs12)) {552552+ if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {553553+ if (nested_cpu_has_apic_reg_virt(vmcs12)) {554554+ /*555555+ * L0 need not intercept reads for MSRs between 0x800556556+ * and 0x8ff, it just lets the processor take the value557557+ * from the virtual-APIC page; take those 256 bits558558+ * directly from the L1 bitmap.559559+ */560560+ for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {561561+ unsigned word = msr / BITS_PER_LONG;562562+563563+ msr_bitmap_l0[word] = msr_bitmap_l1[word];564564+ }565565+ }566566+580567 nested_vmx_disable_intercept_for_msr(581568 msr_bitmap_l1, msr_bitmap_l0,582582- X2APIC_MSR(APIC_EOI),583583- MSR_TYPE_W);584584- nested_vmx_disable_intercept_for_msr(585585- msr_bitmap_l1, msr_bitmap_l0,586586- X2APIC_MSR(APIC_SELF_IPI),587587- MSR_TYPE_W);569569+ X2APIC_MSR(APIC_TASKPRI),570570+ MSR_TYPE_R | MSR_TYPE_W);571571+572572+ if (nested_cpu_has_vid(vmcs12)) {573573+ nested_vmx_disable_intercept_for_msr(574574+ msr_bitmap_l1, msr_bitmap_l0,575575+ X2APIC_MSR(APIC_EOI),576576+ MSR_TYPE_W);577577+ nested_vmx_disable_intercept_for_msr(578578+ msr_bitmap_l1, msr_bitmap_l0,579579+ X2APIC_MSR(APIC_SELF_IPI),580580+ MSR_TYPE_W);581581+ }588582 }589583590584 if (spec_ctrl)
···59596060static inline void syscall_get_arguments(struct task_struct *task,6161 struct pt_regs *regs,6262- unsigned int i, unsigned int n,6362 unsigned long *args)6463{6564 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;6666- unsigned int j;6565+ unsigned int i;67666868- if (n == 0)6969- return;7070-7171- WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS);7272-7373- for (j = 0; j < n; ++j) {7474- if (i + j < SYSCALL_MAX_ARGS)7575- args[j] = regs->areg[reg[i + j]];7676- else7777- args[j] = 0;7878- }6767+ for (i = 0; i < 6; ++i)6868+ args[i] = regs->areg[reg[i]];7969}80708171static inline void syscall_set_arguments(struct task_struct *task,8272 struct pt_regs *regs,8383- unsigned int i, unsigned int n,8473 const unsigned long *args)8574{8675 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;8787- unsigned int j;7676+ unsigned int i;88778989- if (n == 0)9090- return;9191-9292- if (WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS)) {9393- if (i < SYSCALL_MAX_ARGS)9494- n = SYSCALL_MAX_ARGS - i;9595- else9696- return;9797- }9898-9999- for (j = 0; j < n; ++j)100100- regs->areg[reg[i + j]] = args[j];7878+ for (i = 0; i < 6; ++i)7979+ regs->areg[reg[i]] = args[i];10180}1028110382asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
···253253 return 1;254254}255255256256+/*257257+ * level == 0 is for the return address from the caller of this function,258258+ * not from this function itself.259259+ */256260unsigned long return_address(unsigned level)257261{258262 struct return_addr_data r = {259259- .skip = level + 1,263263+ .skip = level,260264 };261265 walk_stackframe(stack_pointer(NULL), return_address_cb, &r);262266 return r.addr;
+1-1
arch/xtensa/mm/mmu.c
···33333434 pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);3535 if (!pte)3636- panic("%s: Failed to allocate %zu bytes align=%lx\n",3636+ panic("%s: Failed to allocate %lu bytes align=%lx\n",3737 __func__, n_pages * sizeof(pte_t), PAGE_SIZE);38383939 for (i = 0; i < n_pages; ++i)
+1-1
block/bfq-iosched.c
···674674 * at least two nodes.675675 */676676 return !(varied_queue_weights || multiple_classes_busy677677-#ifdef BFQ_GROUP_IOSCHED_ENABLED677677+#ifdef CONFIG_BFQ_GROUP_IOSCHED678678 || bfqd->num_groups_with_pending_reqs > 0679679#endif680680 );
···12451245 */12461246blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)12471247{12481248- blk_qc_t unused;12491249-12501248 if (blk_cloned_rq_check_limits(q, rq))12511249 return BLK_STS_IOERR;12521250···12601262 * bypass a potential scheduler on the bottom device for12611263 * insert.12621264 */12631263- return blk_mq_try_issue_directly(rq->mq_hctx, rq, &unused, true, true);12651265+ return blk_mq_request_issue_directly(rq, true);12641266}12651267EXPORT_SYMBOL_GPL(blk_insert_cloned_request);12661268
+5-3
block/blk-mq-sched.c
···423423 * busy in case of 'none' scheduler, and this way may save424424 * us one extra enqueue & dequeue to sw queue.425425 */426426- if (!hctx->dispatch_busy && !e && !run_queue_async)426426+ if (!hctx->dispatch_busy && !e && !run_queue_async) {427427 blk_mq_try_issue_list_directly(hctx, list);428428- else429429- blk_mq_insert_requests(hctx, ctx, list);428428+ if (list_empty(list))429429+ return;430430+ }431431+ blk_mq_insert_requests(hctx, ctx, list);430432 }431433432434 blk_mq_run_hw_queue(hctx, run_queue_async);
+68-61
block/blk-mq.c
···17111711 unsigned int depth;1712171217131713 list_splice_init(&plug->mq_list, &list);17141714- plug->rq_count = 0;1715171417161715 if (plug->rq_count > 2 && plug->multiple_queues)17171716 list_sort(NULL, &list, plug_rq_cmp);17171717+17181718+ plug->rq_count = 0;1718171917191720 this_q = NULL;17201721 this_hctx = NULL;···18011800 return ret;18021801}1803180218041804-blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,18031803+static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,18051804 struct request *rq,18061805 blk_qc_t *cookie,18071807- bool bypass, bool last)18061806+ bool bypass_insert, bool last)18081807{18091808 struct request_queue *q = rq->q;18101809 bool run_queue = true;18111811- blk_status_t ret = BLK_STS_RESOURCE;18121812- int srcu_idx;18131813- bool force = false;1814181018151815- hctx_lock(hctx, &srcu_idx);18161811 /*18171817- * hctx_lock is needed before checking quiesced flag.18121812+ * RCU or SRCU read lock is needed before checking quiesced flag.18181813 *18191819- * When queue is stopped or quiesced, ignore 'bypass', insert18201820- * and return BLK_STS_OK to caller, and avoid driver to try to18211821- * dispatch again.18141814+ * When queue is stopped or quiesced, ignore 'bypass_insert' from18151815+ * blk_mq_request_issue_directly(), and return BLK_STS_OK to caller,18161816+ * and avoid driver to try to dispatch again.18221817 */18231823- if (unlikely(blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q))) {18181818+ if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {18241819 run_queue = false;18251825- bypass = false;18261826- goto out_unlock;18201820+ bypass_insert = false;18211821+ goto insert;18271822 }1828182318291829- if (unlikely(q->elevator && !bypass))18301830- goto out_unlock;18241824+ if (q->elevator && !bypass_insert)18251825+ goto insert;1831182618321827 if (!blk_mq_get_dispatch_budget(hctx))18331833- goto out_unlock;18281828+ goto insert;1834182918351830 if (!blk_mq_get_driver_tag(rq)) {18361831 blk_mq_put_dispatch_budget(hctx);18371837- goto out_unlock;18321832+ goto insert;18381833 }1839183418401840- /*18411841- * Always add a request that has been through18421842- *.queue_rq() to the hardware dispatch list.18431843- */18441844- force = true;18451845- ret = __blk_mq_issue_directly(hctx, rq, cookie, last);18461846-out_unlock:18351835+ return __blk_mq_issue_directly(hctx, rq, cookie, last);18361836+insert:18371837+ if (bypass_insert)18381838+ return BLK_STS_RESOURCE;18391839+18401840+ blk_mq_request_bypass_insert(rq, run_queue);18411841+ return BLK_STS_OK;18421842+}18431843+18441844+static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,18451845+ struct request *rq, blk_qc_t *cookie)18461846+{18471847+ blk_status_t ret;18481848+ int srcu_idx;18491849+18501850+ might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);18511851+18521852+ hctx_lock(hctx, &srcu_idx);18531853+18541854+ ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true);18551855+ if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)18561856+ blk_mq_request_bypass_insert(rq, true);18571857+ else if (ret != BLK_STS_OK)18581858+ blk_mq_end_request(rq, ret);18591859+18471860 hctx_unlock(hctx, srcu_idx);18481848- switch (ret) {18491849- case BLK_STS_OK:18501850- break;18511851- case BLK_STS_DEV_RESOURCE:18521852- case BLK_STS_RESOURCE:18531853- if (force) {18541854- blk_mq_request_bypass_insert(rq, run_queue);18551855- /*18561856- * We have to return BLK_STS_OK for the DM18571857- * to avoid livelock. Otherwise, we return18581858- * the real result to indicate whether the18591859- * request is direct-issued successfully.18601860- */18611861- ret = bypass ? BLK_STS_OK : ret;18621862- } else if (!bypass) {18631863- blk_mq_sched_insert_request(rq, false,18641864- run_queue, false);18651865- }18661866- break;18671867- default:18681868- if (!bypass)18691869- blk_mq_end_request(rq, ret);18701870- break;18711871- }18611861+}18621862+18631863+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last)18641864+{18651865+ blk_status_t ret;18661866+ int srcu_idx;18671867+ blk_qc_t unused_cookie;18681868+ struct blk_mq_hw_ctx *hctx = rq->mq_hctx;18691869+18701870+ hctx_lock(hctx, &srcu_idx);18711871+ ret = __blk_mq_try_issue_directly(hctx, rq, &unused_cookie, true, last);18721872+ hctx_unlock(hctx, srcu_idx);1872187318731874 return ret;18741875}···18781875void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,18791876 struct list_head *list)18801877{18811881- blk_qc_t unused;18821882- blk_status_t ret = BLK_STS_OK;18831883-18841878 while (!list_empty(list)) {18791879+ blk_status_t ret;18851880 struct request *rq = list_first_entry(list, struct request,18861881 queuelist);1887188218881883 list_del_init(&rq->queuelist);18891889- if (ret == BLK_STS_OK)18901890- ret = blk_mq_try_issue_directly(hctx, rq, &unused,18911891- false,18841884+ ret = blk_mq_request_issue_directly(rq, list_empty(list));18851885+ if (ret != BLK_STS_OK) {18861886+ if (ret == BLK_STS_RESOURCE ||18871887+ ret == BLK_STS_DEV_RESOURCE) {18881888+ blk_mq_request_bypass_insert(rq,18921889 list_empty(list));18931893- else18941894- blk_mq_sched_insert_request(rq, false, true, false);18901890+ break;18911891+ }18921892+ blk_mq_end_request(rq, ret);18931893+ }18951894 }1896189518971896 /*···19011896 * the driver there was more coming, but that turned out to19021897 * be a lie.19031898 */19041904- if (ret != BLK_STS_OK && hctx->queue->mq_ops->commit_rqs)18991899+ if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs)19051900 hctx->queue->mq_ops->commit_rqs(hctx);19061901}19071902···20082003 plug->rq_count--;20092004 }20102005 blk_add_rq_to_plug(plug, rq);20062006+ trace_block_plug(q);2011200720122008 blk_mq_put_ctx(data.ctx);2013200920142010 if (same_queue_rq) {20152011 data.hctx = same_queue_rq->mq_hctx;20122012+ trace_block_unplug(q, 1, true);20162013 blk_mq_try_issue_directly(data.hctx, same_queue_rq,20172017- &cookie, false, true);20142014+ &cookie);20182015 }20192016 } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&20202017 !data.hctx->dispatch_busy)) {20212018 blk_mq_put_ctx(data.ctx);20222019 blk_mq_bio_to_request(rq, bio);20232023- blk_mq_try_issue_directly(data.hctx, rq, &cookie, false, true);20202020+ blk_mq_try_issue_directly(data.hctx, rq, &cookie);20242021 } else {20252022 blk_mq_put_ctx(data.ctx);20262023 blk_mq_bio_to_request(rq, bio);···23392332 return 0;2340233323412334 free_fq:23422342- kfree(hctx->fq);23352335+ blk_free_flush_queue(hctx->fq);23432336 exit_hctx:23442337 if (set->ops->exit_hctx)23452338 set->ops->exit_hctx(hctx, hctx_idx);
···314314 disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops,315315 1, BLK_MQ_F_SHOULD_MERGE);316316 if (IS_ERR(disk->queue)) {317317+ put_disk(disk);317318 disk->queue = NULL;318319 continue;319320 }···751750752751 printk("%s: No CD-ROM drive found\n", name);753752 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {753753+ if (!cd->disk)754754+ continue;754755 blk_cleanup_queue(cd->disk->queue);755756 cd->disk->queue = NULL;756757 blk_mq_free_tag_set(&cd->tag_set);···10131010 pcd_probe_capabilities();1014101110151012 if (register_blkdev(major, name)) {10161016- for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)10131013+ for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {10141014+ if (!cd->disk)10151015+ continue;10161016+10171017+ blk_cleanup_queue(cd->disk->queue);10181018+ blk_mq_free_tag_set(&cd->tag_set);10171019 put_disk(cd->disk);10201020+ }10181021 return -EBUSY;10191022 }10201023···10411032 int unit;1042103310431034 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {10351035+ if (!cd->disk)10361036+ continue;10371037+10441038 if (cd->present) {10451039 del_gendisk(cd->disk);10461040 pi_release(cd->pi);
+11-1
drivers/block/paride/pf.c
···762762763763 printk("%s: No ATAPI disk detected\n", name);764764 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {765765+ if (!pf->disk)766766+ continue;765767 blk_cleanup_queue(pf->disk->queue);766768 pf->disk->queue = NULL;767769 blk_mq_free_tag_set(&pf->tag_set);···10311029 pf_busy = 0;1032103010331031 if (register_blkdev(major, name)) {10341034- for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)10321032+ for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {10331033+ if (!pf->disk)10341034+ continue;10351035+ blk_cleanup_queue(pf->disk->queue);10361036+ blk_mq_free_tag_set(&pf->tag_set);10351037 put_disk(pf->disk);10381038+ }10361039 return -EBUSY;10371040 }10381041···10581051 int unit;10591052 unregister_blkdev(major, name);10601053 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {10541054+ if (!pf->disk)10551055+ continue;10561056+10611057 if (pf->present)10621058 del_gendisk(pf->disk);10631059
···3737 *3838 * Returns size of the event. If it is an invalid event, returns 0.3939 */4040-static int calc_tpm2_event_size(struct tcg_pcr_event2_head *event,4141- struct tcg_pcr_event *event_header)4040+static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event,4141+ struct tcg_pcr_event *event_header)4242{4343 struct tcg_efi_specid_event_head *efispecid;4444 struct tcg_event_field *event_field;
+8-1
drivers/char/tpm/tpm-dev-common.c
···233233 __poll_t mask = 0;234234235235 poll_wait(file, &priv->async_wait, wait);236236+ mutex_lock(&priv->buffer_mutex);236237237237- if (!priv->response_read || priv->response_length)238238+ /*239239+ * The response_length indicates if there is still response240240+ * (or part of it) to be consumed. Partial reads decrease it241241+ * by the number of bytes read, and write resets it the zero.242242+ */243243+ if (priv->response_length)238244 mask = EPOLLIN | EPOLLRDNORM;239245 else240246 mask = EPOLLOUT | EPOLLWRNORM;241247248248+ mutex_unlock(&priv->buffer_mutex);242249 return mask;243250}244251
+6-8
drivers/char/tpm/tpm-interface.c
···402402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)403403 return 0;404404405405- if (chip->flags & TPM_CHIP_FLAG_TPM2) {406406- mutex_lock(&chip->tpm_mutex);407407- if (!tpm_chip_start(chip)) {405405+ if (!tpm_chip_start(chip)) {406406+ if (chip->flags & TPM_CHIP_FLAG_TPM2)408407 tpm2_shutdown(chip, TPM2_SU_STATE);409409- tpm_chip_stop(chip);410410- }411411- mutex_unlock(&chip->tpm_mutex);412412- } else {413413- rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);408408+ else409409+ rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);410410+411411+ tpm_chip_stop(chip);414412 }415413416414 return rc;
···913913static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2)914914{915915 return range1->logical_sector < range2->logical_sector + range2->n_sectors &&916916- range2->logical_sector + range2->n_sectors > range2->logical_sector;916916+ range1->logical_sector + range1->n_sectors > range2->logical_sector;917917}918918919919static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting)···959959 struct dm_integrity_range *last_range =960960 list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry);961961 struct task_struct *last_range_task;962962- if (!ranges_overlap(range, last_range))963963- break;964962 last_range_task = last_range->task;965963 list_del(&last_range->wait_entry);966964 if (!add_new_range(ic, last_range, false)) {···31833185 journal_watermark = val;31843186 else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1)31853187 sync_msec = val;31863186- else if (!memcmp(opt_string, "meta_device:", strlen("meta_device:"))) {31883188+ else if (!strncmp(opt_string, "meta_device:", strlen("meta_device:"))) {31873189 if (ic->meta_dev) {31883190 dm_put_device(ti, ic->meta_dev);31893191 ic->meta_dev = NULL;···32023204 goto bad;32033205 }32043206 ic->sectors_per_block = val >> SECTOR_SHIFT;32053205- } else if (!memcmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {32073207+ } else if (!strncmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {32063208 r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error,32073209 "Invalid internal_hash argument");32083210 if (r)32093211 goto bad;32103210- } else if (!memcmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {32123212+ } else if (!strncmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {32113213 r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error,32123214 "Invalid journal_crypt argument");32133215 if (r)32143216 goto bad;32153215- } else if (!memcmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {32173217+ } else if (!strncmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {32163218 r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error,32173219 "Invalid journal_mac argument");32183220 if (r)···36143616 .io_hints = dm_integrity_io_hints,36153617};3616361836173617-int __init dm_integrity_init(void)36193619+static int __init dm_integrity_init(void)36183620{36193621 int r;36203622···36333635 return r;36343636}3635363736363636-void dm_integrity_exit(void)36383638+static void __exit dm_integrity_exit(void)36373639{36383640 dm_unregister_target(&integrity_target);36393641 kmem_cache_destroy(journal_io_cache);
+7-4
drivers/md/dm-rq.c
···222222 }223223224224 if (unlikely(error == BLK_STS_TARGET)) {225225- if (req_op(clone) == REQ_OP_WRITE_SAME &&226226- !clone->q->limits.max_write_same_sectors)225225+ if (req_op(clone) == REQ_OP_DISCARD &&226226+ !clone->q->limits.max_discard_sectors)227227+ disable_discard(tio->md);228228+ else if (req_op(clone) == REQ_OP_WRITE_SAME &&229229+ !clone->q->limits.max_write_same_sectors)227230 disable_write_same(tio->md);228228- if (req_op(clone) == REQ_OP_WRITE_ZEROES &&229229- !clone->q->limits.max_write_zeroes_sectors)231231+ else if (req_op(clone) == REQ_OP_WRITE_ZEROES &&232232+ !clone->q->limits.max_write_zeroes_sectors)230233 disable_write_zeroes(tio->md);231234 }232235
+39
drivers/md/dm-table.c
···18441844 return true;18451845}1846184618471847+static int device_requires_stable_pages(struct dm_target *ti,18481848+ struct dm_dev *dev, sector_t start,18491849+ sector_t len, void *data)18501850+{18511851+ struct request_queue *q = bdev_get_queue(dev->bdev);18521852+18531853+ return q && bdi_cap_stable_pages_required(q->backing_dev_info);18541854+}18551855+18561856+/*18571857+ * If any underlying device requires stable pages, a table must require18581858+ * them as well. Only targets that support iterate_devices are considered:18591859+ * don't want error, zero, etc to require stable pages.18601860+ */18611861+static bool dm_table_requires_stable_pages(struct dm_table *t)18621862+{18631863+ struct dm_target *ti;18641864+ unsigned i;18651865+18661866+ for (i = 0; i < dm_table_get_num_targets(t); i++) {18671867+ ti = dm_table_get_target(t, i);18681868+18691869+ if (ti->type->iterate_devices &&18701870+ ti->type->iterate_devices(ti, device_requires_stable_pages, NULL))18711871+ return true;18721872+ }18731873+18741874+ return false;18751875+}18761876+18471877void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,18481878 struct queue_limits *limits)18491879{···19251895 q->limits.max_write_zeroes_sectors = 0;1926189619271897 dm_table_verify_integrity(t);18981898+18991899+ /*19001900+ * Some devices don't use blk_integrity but still want stable pages19011901+ * because they do their own checksumming.19021902+ */19031903+ if (dm_table_requires_stable_pages(t))19041904+ q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;19051905+ else19061906+ q->backing_dev_info->capabilities &= ~BDI_CAP_STABLE_WRITES;1928190719291908 /*19301909 * Determine whether or not this queue's I/O timings contribute
+17-13
drivers/md/dm.c
···945945 }946946}947947948948+void disable_discard(struct mapped_device *md)949949+{950950+ struct queue_limits *limits = dm_get_queue_limits(md);951951+952952+ /* device doesn't really support DISCARD, disable it */953953+ limits->max_discard_sectors = 0;954954+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue);955955+}956956+948957void disable_write_same(struct mapped_device *md)949958{950959 struct queue_limits *limits = dm_get_queue_limits(md);···979970 dm_endio_fn endio = tio->ti->type->end_io;980971981972 if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {982982- if (bio_op(bio) == REQ_OP_WRITE_SAME &&983983- !bio->bi_disk->queue->limits.max_write_same_sectors)973973+ if (bio_op(bio) == REQ_OP_DISCARD &&974974+ !bio->bi_disk->queue->limits.max_discard_sectors)975975+ disable_discard(md);976976+ else if (bio_op(bio) == REQ_OP_WRITE_SAME &&977977+ !bio->bi_disk->queue->limits.max_write_same_sectors)984978 disable_write_same(md);985985- if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&986986- !bio->bi_disk->queue->limits.max_write_zeroes_sectors)979979+ else if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&980980+ !bio->bi_disk->queue->limits.max_write_zeroes_sectors)987981 disable_write_zeroes(md);988982 }989983···10541042 return -EINVAL;10551043 }1056104410571057- /*10581058- * BIO based queue uses its own splitting. When multipage bvecs10591059- * is switched on, size of the incoming bio may be too big to10601060- * be handled in some targets, such as crypt.10611061- *10621062- * When these targets are ready for the big bio, we can remove10631063- * the limit.10641064- */10651065- ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE);10451045+ ti->max_io_len = (uint32_t) len;1066104610671047 return 0;10681048}
+5-1
drivers/mtd/chips/cfi_cmdset_0002.c
···18761876 continue;18771877 }1878187818791879- if (time_after(jiffies, timeo) && !chip_ready(map, adr))18791879+ /*18801880+ * We check "time_after" and "!chip_good" before checking "chip_good" to avoid18811881+ * the failure due to scheduling.18821882+ */18831883+ if (time_after(jiffies, timeo) && !chip_good(map, adr, datum))18801884 break;1881188518821886 if (chip_good(map, adr, datum)) {
···898898899899 /* First, update TX stats if needed */900900 if (skb) {901901- if (gem_ptp_do_txstamp(queue, skb, desc) == 0) {901901+ if (unlikely(skb_shinfo(skb)->tx_flags &902902+ SKBTX_HW_TSTAMP) &&903903+ gem_ptp_do_txstamp(queue, skb, desc) == 0) {902904 /* skb now belongs to timestamp buffer903905 * and will be removed later904906 */
···2828#include <linux/pm_runtime.h>2929#include <linux/firmware.h>3030#include <linux/prefetch.h>3131+#include <linux/pci-aspm.h>3132#include <linux/ipv6.h>3233#include <net/ip6_checksum.h>3334···73367335 rc = rtl_get_ether_clk(tp);73377336 if (rc)73387337 return rc;73387338+73397339+ /* Disable ASPM completely as that cause random device stop working73407340+ * problems as well as full system hangs for some PCIe devices users.73417341+ */73427342+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);7339734373407344 /* enable device (incl. PCI PM wakeup and hotplug setup) */73417345 rc = pcim_enable_device(pdev);
+6-2
drivers/net/vrf.c
···12731273 dev->priv_flags |= IFF_NO_QUEUE;12741274 dev->priv_flags |= IFF_NO_RX_HANDLER;1275127512761276- dev->min_mtu = 0;12771277- dev->max_mtu = 0;12761276+ /* VRF devices do not care about MTU, but if the MTU is set12771277+ * too low then the ipv4 and ipv6 protocols are disabled12781278+ * which breaks networking.12791279+ */12801280+ dev->min_mtu = IPV6_MIN_MTU;12811281+ dev->max_mtu = ETH_MAX_MTU;12781282}1279128312801284static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
···667667 will be called rtc-s5m.668668669669config RTC_DRV_SD3078670670- tristate "ZXW Crystal SD3078"670670+ tristate "ZXW Shenzhen whwave SD3078"671671 help672672- If you say yes here you get support for the ZXW Crystal672672+ If you say yes here you get support for the ZXW Shenzhen whwave673673 SD3078 RTC chips.674674675675 This driver can also be built as a module. If so, the module
···480480 da9063_data_to_tm(data, &rtc->alarm_time, rtc);481481 rtc->rtc_sync = false;482482483483+ /*484484+ * TODO: some models have alarms on a minute boundary but still support485485+ * real hardware interrupts. Add this once the core supports it.486486+ */487487+ if (config->rtc_data_start != RTC_SEC)488488+ rtc->rtc_dev->uie_unsupported = 1;489489+483490 irq_alarm = platform_get_irq_byname(pdev, "ALARM");484491 ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,485492 da9063_alarm_event,
+1-1
drivers/rtc/rtc-sh.c
···374374static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)375375{376376 unsigned int byte;377377- int value = 0xff; /* return 0xff for ignored values */377377+ int value = -1; /* return -1 for ignored values */378378379379 byte = readb(rtc->regbase + reg_off);380380 if (byte & AR_ENB) {
+3-4
drivers/scsi/lpfc/lpfc_scsi.c
···38783878 * wake up the thread.38793879 */38803880 spin_lock(&lpfc_cmd->buf_lock);38813881- if (unlikely(lpfc_cmd->cur_iocbq.iocb_flag & LPFC_DRIVER_ABORTED)) {38823882- lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;38833883- if (lpfc_cmd->waitq)38843884- wake_up(lpfc_cmd->waitq);38813881+ lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;38823882+ if (lpfc_cmd->waitq) {38833883+ wake_up(lpfc_cmd->waitq);38853884 lpfc_cmd->waitq = NULL;38863885 }38873886 spin_unlock(&lpfc_cmd->buf_lock);
+2-5
drivers/scsi/qedi/qedi_main.c
···1392139213931393static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)13941394{13951395- struct qedi_nvm_iscsi_image nvm_image;13961396-13971395 qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,13981398- sizeof(nvm_image),13961396+ sizeof(struct qedi_nvm_iscsi_image),13991397 &qedi->nvm_buf_dma, GFP_KERNEL);14001398 if (!qedi->iscsi_image) {14011399 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");···22342236static int qedi_get_boot_info(struct qedi_ctx *qedi)22352237{22362238 int ret = 1;22372237- struct qedi_nvm_iscsi_image nvm_image;2238223922392240 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,22402241 "Get NVM iSCSI CFG image\n");22412242 ret = qedi_ops->common->nvm_get_image(qedi->cdev,22422243 QED_NVM_IMAGE_ISCSI_CFG,22432244 (char *)qedi->iscsi_image,22442244- sizeof(nvm_image));22452245+ sizeof(struct qedi_nvm_iscsi_image));22452246 if (ret)22462247 QEDI_ERR(&qedi->dbg_ctx,22472248 "Could not get NVM image. ret = %d\n", ret);
···385385 * This is the end of Protocol specific defines.386386 */387387388388-static int storvsc_ringbuffer_size = (256 * PAGE_SIZE);388388+static int storvsc_ringbuffer_size = (128 * 1024);389389static u32 max_outstanding_req_per_channel;390390391391static int storvsc_vcpus_per_sub_channel = 4;···668668{669669 struct device *dev = &device->device;670670 struct storvsc_device *stor_device;671671- int num_cpus = num_online_cpus();672671 int num_sc;673672 struct storvsc_cmd_request *request;674673 struct vstor_packet *vstor_packet;675674 int ret, t;676675677677- num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns);676676+ /*677677+ * If the number of CPUs is artificially restricted, such as678678+ * with maxcpus=1 on the kernel boot line, Hyper-V could offer679679+ * sub-channels >= the number of CPUs. These sub-channels680680+ * should not be created. The primary channel is already created681681+ * and assigned to one CPU, so check against # CPUs - 1.682682+ */683683+ num_sc = min((int)(num_online_cpus() - 1), max_chns);684684+ if (!num_sc)685685+ return;686686+678687 stor_device = get_out_stor_device(device);679688 if (!stor_device)680689 return;
+2-2
drivers/vfio/pci/vfio_pci.c
···16611661 rc = pci_add_dynid(&vfio_pci_driver, vendor, device,16621662 subvendor, subdevice, class, class_mask, 0);16631663 if (rc)16641664- pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n",16641664+ pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n",16651665 vendor, device, subvendor, subdevice,16661666 class, class_mask, rc);16671667 else16681668- pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n",16681668+ pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n",16691669 vendor, device, subvendor, subdevice,16701670 class, class_mask);16711671 }
···12151215}1216121612171217EXPORT_SYMBOL(nonseekable_open);12181218+12191219+/*12201220+ * stream_open is used by subsystems that want stream-like file descriptors.12211221+ * Such file descriptors are not seekable and don't have notion of position12221222+ * (file.f_pos is always 0). Contrary to file descriptors of other regular12231223+ * files, .read() and .write() can run simultaneously.12241224+ *12251225+ * stream_open never fails and is marked to return int so that it could be12261226+ * directly used as file_operations.open .12271227+ */12281228+int stream_open(struct inode *inode, struct file *filp)12291229+{12301230+ filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | FMODE_ATOMIC_POS);12311231+ filp->f_mode |= FMODE_STREAM;12321232+ return 0;12331233+}12341234+12351235+EXPORT_SYMBOL(stream_open);
···105105 * syscall_get_arguments - extract system call parameter values106106 * @task: task of interest, must be blocked107107 * @regs: task_pt_regs() of @task108108- * @i: argument index [0,5]109109- * @n: number of arguments; n+i must be [1,6].110108 * @args: array filled with argument values111109 *112112- * Fetches @n arguments to the system call starting with the @i'th argument113113- * (from 0 through 5). Argument @i is stored in @args[0], and so on.114114- * An arch inline version is probably optimal when @i and @n are constants.110110+ * Fetches 6 arguments to the system call. First argument is stored in111111+* @args[0], and so on.115112 *116113 * It's only valid to call this when @task is stopped for tracing on117114 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.118118- * It's invalid to call this with @i + @n > 6; we only support system calls119119- * taking up to 6 arguments.120115 */121116void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,122122- unsigned int i, unsigned int n, unsigned long *args);117117+ unsigned long *args);123118124119/**125120 * syscall_set_arguments - change system call parameter value126121 * @task: task of interest, must be in system call entry tracing127122 * @regs: task_pt_regs() of @task128128- * @i: argument index [0,5]129129- * @n: number of arguments; n+i must be [1,6].130123 * @args: array of argument values to store131124 *132132- * Changes @n arguments to the system call starting with the @i'th argument.133133- * Argument @i gets value @args[0], and so on.134134- * An arch inline version is probably optimal when @i and @n are constants.125125+ * Changes 6 arguments to the system call.126126+ * The first argument gets value @args[0], and so on.135127 *136128 * It's only valid to call this when @task is stopped for tracing on137129 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.138138- * It's invalid to call this with @i + @n > 6; we only support system calls139139- * taking up to 6 arguments.140130 */141131void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,142142- unsigned int i, unsigned int n,143132 const unsigned long *args);144133145134/**
···158158#define FMODE_OPENED ((__force fmode_t)0x80000)159159#define FMODE_CREATED ((__force fmode_t)0x100000)160160161161+/* File is stream-like */162162+#define FMODE_STREAM ((__force fmode_t)0x200000)163163+161164/* File was opened by fanotify and shouldn't generate fanotify events */162165#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)163166···30773074extern loff_t no_seek_end_llseek(struct file *, loff_t, int);30783075extern int generic_file_open(struct inode * inode, struct file * filp);30793076extern int nonseekable_open(struct inode * inode, struct file * filp);30773077+extern int stream_open(struct inode * inode, struct file * filp);3080307830813079#ifdef CONFIG_BLOCK30823080typedef void (dio_submit_t)(struct bio *bio, struct inode *inode,
+4-1
include/linux/memcontrol.h
···566566void __unlock_page_memcg(struct mem_cgroup *memcg);567567void unlock_page_memcg(struct page *page);568568569569-/* idx can be of type enum memcg_stat_item or node_stat_item */569569+/*570570+ * idx can be of type enum memcg_stat_item or node_stat_item.571571+ * Keep in sync with memcg_exact_page_state().572572+ */570573static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,571574 int idx)572575{
+1-1
include/linux/mm_types.h
···671671672672/* Encode hstate index for a hwpoisoned large page */673673#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))674674-#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)674674+#define VM_FAULT_GET_HINDEX(x) (((__force unsigned int)(x) >> 16) & 0xf)675675676676#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \677677 VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \
+8-3
include/linux/ptrace.h
···99#include <linux/bug.h> /* For BUG_ON. */1010#include <linux/pid_namespace.h> /* For task_active_pid_ns. */1111#include <uapi/linux/ptrace.h>1212+#include <linux/seccomp.h>1313+1414+/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */1515+struct syscall_info {1616+ __u64 sp;1717+ struct seccomp_data data;1818+};12191320extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,1421 void *buf, int len, unsigned int gup_flags);···414407#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())415408#endif416409417417-extern int task_current_syscall(struct task_struct *target, long *callno,418418- unsigned long args[6], unsigned int maxargs,419419- unsigned long *sp, unsigned long *pc);410410+extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);420411421412extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);422413#endif
···128128static int __maybe_unused one = 1;129129static int __maybe_unused two = 2;130130static int __maybe_unused four = 4;131131+static unsigned long zero_ul;131132static unsigned long one_ul = 1;132133static unsigned long long_max = LONG_MAX;133134static int one_hundred = 100;···17511750 .maxlen = sizeof(files_stat.max_files),17521751 .mode = 0644,17531752 .proc_handler = proc_doulongvec_minmax,17541754- .extra1 = &zero,17531753+ .extra1 = &zero_ul,17551754 .extra2 = &long_max,17561755 },17571756 {
+6-3
kernel/trace/trace_syscalls.c
···314314 struct ring_buffer_event *event;315315 struct ring_buffer *buffer;316316 unsigned long irq_flags;317317+ unsigned long args[6];317318 int pc;318319 int syscall_nr;319320 int size;···348347349348 entry = ring_buffer_event_data(event);350349 entry->nr = syscall_nr;351351- syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);350350+ syscall_get_arguments(current, regs, args);351351+ memcpy(entry->args, args, sizeof(unsigned long) * sys_data->nb_args);352352353353 event_trigger_unlock_commit(trace_file, buffer, event, entry,354354 irq_flags, pc);···585583 struct syscall_metadata *sys_data;586584 struct syscall_trace_enter *rec;587585 struct hlist_head *head;586586+ unsigned long args[6];588587 bool valid_prog_array;589588 int syscall_nr;590589 int rctx;···616613 return;617614618615 rec->nr = syscall_nr;619619- syscall_get_arguments(current, regs, 0, sys_data->nb_args,620620- (unsigned long *)&rec->args);616616+ syscall_get_arguments(current, regs, args);617617+ memcpy(&rec->args, args, sizeof(unsigned long) * sys_data->nb_args);621618622619 if ((valid_prog_array &&623620 !perf_call_bpf_enter(sys_data->enter_event, regs, sys_data, rec)) ||
+6-3
lib/lzo/lzo1x_compress.c
···291291{292292 const unsigned char *ip = in;293293 unsigned char *op = out;294294+ unsigned char *data_start;294295 size_t l = in_len;295296 size_t t = 0;296297 signed char state_offset = -2;297298 unsigned int m4_max_offset;298299299299- // LZO v0 will never write 17 as first byte,300300- // so this is used to version the bitstream300300+ // LZO v0 will never write 17 as first byte (except for zero-length301301+ // input), so this is used to version the bitstream301302 if (bitstream_version > 0) {302303 *op++ = 17;303304 *op++ = bitstream_version;···306305 } else {307306 m4_max_offset = M4_MAX_OFFSET_V0;308307 }308308+309309+ data_start = op;309310310311 while (l > 20) {311312 size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1);···327324 if (t > 0) {328325 const unsigned char *ii = in + in_len - t;329326330330- if (op == out && t <= 238) {327327+ if (op == data_start && t <= 238) {331328 *op++ = (17 + t);332329 } else if (t <= 3) {333330 op[state_offset] |= t;
+1-3
lib/lzo/lzo1x_decompress_safe.c
···5454 if (unlikely(in_len < 3))5555 goto input_overrun;56565757- if (likely(*ip == 17)) {5757+ if (likely(in_len >= 5) && likely(*ip == 17)) {5858 bitstream_version = ip[1];5959 ip += 2;6060- if (unlikely(in_len < 5))6161- goto input_overrun;6260 } else {6361 bitstream_version = 0;6462 }
+20
lib/string.c
···866866EXPORT_SYMBOL(memcmp);867867#endif868868869869+#ifndef __HAVE_ARCH_BCMP870870+/**871871+ * bcmp - returns 0 if and only if the buffers have identical contents.872872+ * @a: pointer to first buffer.873873+ * @b: pointer to second buffer.874874+ * @len: size of buffers.875875+ *876876+ * The sign or magnitude of a non-zero return value has no particular877877+ * meaning, and architectures may implement their own more efficient bcmp(). So878878+ * while this particular implementation is a simple (tail) call to memcmp, do879879+ * not rely on anything but whether the return value is zero or non-zero.880880+ */881881+#undef bcmp882882+int bcmp(const void *a, const void *b, size_t len)883883+{884884+ return memcmp(a, b, len);885885+}886886+EXPORT_SYMBOL(bcmp);887887+#endif888888+869889#ifndef __HAVE_ARCH_MEMSCAN870890/**871891 * memscan - Find a character in an area of memory.
+25-32
lib/syscall.c
···55#include <linux/export.h>66#include <asm/syscall.h>7788-static int collect_syscall(struct task_struct *target, long *callno,99- unsigned long args[6], unsigned int maxargs,1010- unsigned long *sp, unsigned long *pc)88+static int collect_syscall(struct task_struct *target, struct syscall_info *info)119{1210 struct pt_regs *regs;13111412 if (!try_get_task_stack(target)) {1513 /* Task has no stack, so the task isn't in a syscall. */1616- *sp = *pc = 0;1717- *callno = -1;1414+ memset(info, 0, sizeof(*info));1515+ info->data.nr = -1;1816 return 0;1917 }2018···2224 return -EAGAIN;2325 }24262525- *sp = user_stack_pointer(regs);2626- *pc = instruction_pointer(regs);2727+ info->sp = user_stack_pointer(regs);2828+ info->data.instruction_pointer = instruction_pointer(regs);27292828- *callno = syscall_get_nr(target, regs);2929- if (*callno != -1L && maxargs > 0)3030- syscall_get_arguments(target, regs, 0, maxargs, args);3030+ info->data.nr = syscall_get_nr(target, regs);3131+ if (info->data.nr != -1L)3232+ syscall_get_arguments(target, regs,3333+ (unsigned long *)&info->data.args[0]);31343235 put_task_stack(target);3336 return 0;···3738/**3839 * task_current_syscall - Discover what a blocked task is doing.3940 * @target: thread to examine4040- * @callno: filled with system call number or -14141- * @args: filled with @maxargs system call arguments4242- * @maxargs: number of elements in @args to fill4343- * @sp: filled with user stack pointer4444- * @pc: filled with user PC4141+ * @info: structure with the following fields:4242+ * .sp - filled with user stack pointer4343+ * .data.nr - filled with system call number or -14444+ * .data.args - filled with @maxargs system call arguments4545+ * .data.instruction_pointer - filled with user PC4546 *4646- * If @target is blocked in a system call, returns zero with *@callno4747- * set to the the call's number and @args filled in with its arguments.4848- * Registers not used for system call arguments may not be available and4949- * it is not kosher to use &struct user_regset calls while the system4747+ * If @target is blocked in a system call, returns zero with @info.data.nr4848+ * set to the the call's number and @info.data.args filled in with its4949+ * arguments. Registers not used for system call arguments may not be available5050+ * and it is not kosher to use &struct user_regset calls while the system5051 * call is still in progress. Note we may get this result if @target5152 * has finished its system call but not yet returned to user mode, such5253 * as when it's stopped for signal handling or syscall exit tracing.5354 *5455 * If @target is blocked in the kernel during a fault or exception,5555- * returns zero with *@callno set to -1 and does not fill in @args.5656- * If so, it's now safe to examine @target using &struct user_regset5757- * get() calls as long as we're sure @target won't return to user mode.5656+ * returns zero with *@info.data.nr set to -1 and does not fill in5757+ * @info.data.args. If so, it's now safe to examine @target using5858+ * &struct user_regset get() calls as long as we're sure @target won't return5959+ * to user mode.5860 *5961 * Returns -%EAGAIN if @target does not remain blocked.6060- *6161- * Returns -%EINVAL if @maxargs is too large (maximum is six).6262 */6363-int task_current_syscall(struct task_struct *target, long *callno,6464- unsigned long args[6], unsigned int maxargs,6565- unsigned long *sp, unsigned long *pc)6363+int task_current_syscall(struct task_struct *target, struct syscall_info *info)6664{6765 long state;6866 unsigned long ncsw;69677070- if (unlikely(maxargs > 6))7171- return -EINVAL;7272-7368 if (target == current)7474- return collect_syscall(target, callno, args, maxargs, sp, pc);6969+ return collect_syscall(target, info);75707671 state = target->state;7772 if (unlikely(!state))···73807481 ncsw = wait_task_inactive(target, state);7582 if (unlikely(!ncsw) ||7676- unlikely(collect_syscall(target, callno, args, maxargs, sp, pc)) ||8383+ unlikely(collect_syscall(target, info)) ||7784 unlikely(wait_task_inactive(target, state) != ncsw))7885 return -EAGAIN;7986
···15291529 }15301530 rcu_read_unlock();1531153115321532- /* data/bss scanning */15331533- scan_large_block(_sdata, _edata);15341534- scan_large_block(__bss_start, __bss_stop);15351535- scan_large_block(__start_ro_after_init, __end_ro_after_init);15361536-15371532#ifdef CONFIG_SMP15381533 /* per-cpu sections scanning */15391534 for_each_possible_cpu(i)···20652070 kmemleak_free_enabled = 1;20662071 }20672072 local_irq_restore(flags);20732073+20742074+ /* register the data/bss sections */20752075+ create_object((unsigned long)_sdata, _edata - _sdata,20762076+ KMEMLEAK_GREY, GFP_ATOMIC);20772077+ create_object((unsigned long)__bss_start, __bss_stop - __bss_start,20782078+ KMEMLEAK_GREY, GFP_ATOMIC);20792079+ /* only register .data..ro_after_init if not within .data */20802080+ if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata)20812081+ create_object((unsigned long)__start_ro_after_init,20822082+ __end_ro_after_init - __start_ro_after_init,20832083+ KMEMLEAK_GREY, GFP_ATOMIC);2068208420692085 /*20702086 * This is the point where tracking allocations is safe. Automatic
+18-2
mm/memcontrol.c
···38823882 return &memcg->cgwb_domain;38833883}3884388438853885+/*38863886+ * idx can be of type enum memcg_stat_item or node_stat_item.38873887+ * Keep in sync with memcg_exact_page().38883888+ */38893889+static unsigned long memcg_exact_page_state(struct mem_cgroup *memcg, int idx)38903890+{38913891+ long x = atomic_long_read(&memcg->stat[idx]);38923892+ int cpu;38933893+38943894+ for_each_online_cpu(cpu)38953895+ x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx];38963896+ if (x < 0)38973897+ x = 0;38983898+ return x;38993899+}39003900+38853901/**38863902 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg38873903 * @wb: bdi_writeback in question···39233907 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);39243908 struct mem_cgroup *parent;3925390939263926- *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY);39103910+ *pdirty = memcg_exact_page_state(memcg, NR_FILE_DIRTY);3927391139283912 /* this should eventually include NR_UNSTABLE_NFS */39293929- *pwriteback = memcg_page_state(memcg, NR_WRITEBACK);39133913+ *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);39303914 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |39313915 (1 << LRU_ACTIVE_FILE));39323916 *pheadroom = PAGE_COUNTER_MAX;
···204204 * @s: The string to duplicate205205 * @n: Maximum number of bytes to copy, including the trailing NUL.206206 *207207- * Return: newly allocated copy of @s or %NULL in case of error207207+ * Return: newly allocated copy of @s or an ERR_PTR() in case of error208208 */209209char *strndup_user(const char __user *s, long n)210210{
+10-5
net/ipv4/ip_gre.c
···259259 struct net *net = dev_net(skb->dev);260260 struct metadata_dst *tun_dst = NULL;261261 struct erspan_base_hdr *ershdr;262262- struct erspan_metadata *pkt_md;263262 struct ip_tunnel_net *itn;264263 struct ip_tunnel *tunnel;265264 const struct iphdr *iph;···281282 if (unlikely(!pskb_may_pull(skb, len)))282283 return PACKET_REJECT;283284284284- ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len);285285- pkt_md = (struct erspan_metadata *)(ershdr + 1);286286-287285 if (__iptunnel_pull_header(skb,288286 len,289287 htons(ETH_P_TEB),···288292 goto drop;289293290294 if (tunnel->collect_md) {295295+ struct erspan_metadata *pkt_md, *md;291296 struct ip_tunnel_info *info;292292- struct erspan_metadata *md;297297+ unsigned char *gh;293298 __be64 tun_id;294299 __be16 flags;295300···303306 if (!tun_dst)304307 return PACKET_REJECT;305308309309+ /* skb can be uncloned in __iptunnel_pull_header, so310310+ * old pkt_md is no longer valid and we need to reset311311+ * it312312+ */313313+ gh = skb_network_header(skb) +314314+ skb_network_header_len(skb);315315+ pkt_md = (struct erspan_metadata *)(gh + gre_hdr_len +316316+ sizeof(*ershdr));306317 md = ip_tunnel_info_opts(&tun_dst->u.tun_info);307318 md->version = ver;308319 md2 = &md->u.md2;
+13-7
net/ipv6/ip6_gre.c
···525525}526526527527static int ip6erspan_rcv(struct sk_buff *skb,528528- struct tnl_ptk_info *tpi)528528+ struct tnl_ptk_info *tpi,529529+ int gre_hdr_len)529530{530531 struct erspan_base_hdr *ershdr;531531- struct erspan_metadata *pkt_md;532532 const struct ipv6hdr *ipv6h;533533 struct erspan_md2 *md2;534534 struct ip6_tnl *tunnel;···547547 if (unlikely(!pskb_may_pull(skb, len)))548548 return PACKET_REJECT;549549550550- ershdr = (struct erspan_base_hdr *)skb->data;551551- pkt_md = (struct erspan_metadata *)(ershdr + 1);552552-553550 if (__iptunnel_pull_header(skb, len,554551 htons(ETH_P_TEB),555552 false, false) < 0)556553 return PACKET_REJECT;557554558555 if (tunnel->parms.collect_md) {556556+ struct erspan_metadata *pkt_md, *md;559557 struct metadata_dst *tun_dst;560558 struct ip_tunnel_info *info;561561- struct erspan_metadata *md;559559+ unsigned char *gh;562560 __be64 tun_id;563561 __be16 flags;564562···569571 if (!tun_dst)570572 return PACKET_REJECT;571573574574+ /* skb can be uncloned in __iptunnel_pull_header, so575575+ * old pkt_md is no longer valid and we need to reset576576+ * it577577+ */578578+ gh = skb_network_header(skb) +579579+ skb_network_header_len(skb);580580+ pkt_md = (struct erspan_metadata *)(gh + gre_hdr_len +581581+ sizeof(*ershdr));572582 info = &tun_dst->u.tun_info;573583 md = ip_tunnel_info_opts(info);574584 md->version = ver;···613607614608 if (unlikely(tpi.proto == htons(ETH_P_ERSPAN) ||615609 tpi.proto == htons(ETH_P_ERSPAN2))) {616616- if (ip6erspan_rcv(skb, &tpi) == PACKET_RCVD)610610+ if (ip6erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)617611 return 0;618612 goto out;619613 }
+8
net/nfc/nci/hci.c
···312312 create_info = (struct nci_hci_create_pipe_resp *)skb->data;313313 dest_gate = create_info->dest_gate;314314 new_pipe = create_info->pipe;315315+ if (new_pipe >= NCI_HCI_MAX_PIPES) {316316+ status = NCI_HCI_ANY_E_NOK;317317+ goto exit;318318+ }315319316320 /* Save the new created pipe and bind with local gate,317321 * the description for skb->data[3] is destination gate id···340336 goto exit;341337 }342338 delete_info = (struct nci_hci_delete_pipe_noti *)skb->data;339339+ if (delete_info->pipe >= NCI_HCI_MAX_PIPES) {340340+ status = NCI_HCI_ANY_E_NOK;341341+ goto exit;342342+ }343343344344 ndev->hci_dev->pipes[delete_info->pipe].gate =345345 NCI_HCI_INVALID_GATE;
+363
scripts/coccinelle/api/stream_open.cocci
···11+// SPDX-License-Identifier: GPL-2.022+// Author: Kirill Smelkov (kirr@nexedi.com)33+//44+// Search for stream-like files that are using nonseekable_open and convert55+// them to stream_open. A stream-like file is a file that does not use ppos in66+// its read and write. Rationale for the conversion is to avoid deadlock in77+// between read and write.88+99+virtual report1010+virtual patch1111+virtual explain // explain decisions in the patch (SPFLAGS="-D explain")1212+1313+// stream-like reader & writer - ones that do not depend on f_pos.1414+@ stream_reader @1515+identifier readstream, ppos;1616+identifier f, buf, len;1717+type loff_t;1818+@@1919+ ssize_t readstream(struct file *f, char *buf, size_t len, loff_t *ppos)2020+ {2121+ ... when != ppos2222+ }2323+2424+@ stream_writer @2525+identifier writestream, ppos;2626+identifier f, buf, len;2727+type loff_t;2828+@@2929+ ssize_t writestream(struct file *f, const char *buf, size_t len, loff_t *ppos)3030+ {3131+ ... when != ppos3232+ }3333+3434+3535+// a function that blocks3636+@ blocks @3737+identifier block_f;3838+identifier wait_event =~ "^wait_event_.*";3939+@@4040+ block_f(...) {4141+ ... when exists4242+ wait_event(...)4343+ ... when exists4444+ }4545+4646+// stream_reader that can block inside.4747+//4848+// XXX wait_* can be called not directly from current function (e.g. func -> f -> g -> wait())4949+// XXX currently reader_blocks supports only direct and 1-level indirect cases.5050+@ reader_blocks_direct @5151+identifier stream_reader.readstream;5252+identifier wait_event =~ "^wait_event_.*";5353+@@5454+ readstream(...)5555+ {5656+ ... when exists5757+ wait_event(...)5858+ ... when exists5959+ }6060+6161+@ reader_blocks_1 @6262+identifier stream_reader.readstream;6363+identifier blocks.block_f;6464+@@6565+ readstream(...)6666+ {6767+ ... when exists6868+ block_f(...)6969+ ... when exists7070+ }7171+7272+@ reader_blocks depends on reader_blocks_direct || reader_blocks_1 @7373+identifier stream_reader.readstream;7474+@@7575+ readstream(...) {7676+ ...7777+ }7878+7979+8080+// file_operations + whether they have _any_ .read, .write, .llseek ... at all.8181+//8282+// XXX add support for file_operations xxx[N] = ... (sound/core/pcm_native.c)8383+@ fops0 @8484+identifier fops;8585+@@8686+ struct file_operations fops = {8787+ ...8888+ };8989+9090+@ has_read @9191+identifier fops0.fops;9292+identifier read_f;9393+@@9494+ struct file_operations fops = {9595+ .read = read_f,9696+ };9797+9898+@ has_read_iter @9999+identifier fops0.fops;100100+identifier read_iter_f;101101+@@102102+ struct file_operations fops = {103103+ .read_iter = read_iter_f,104104+ };105105+106106+@ has_write @107107+identifier fops0.fops;108108+identifier write_f;109109+@@110110+ struct file_operations fops = {111111+ .write = write_f,112112+ };113113+114114+@ has_write_iter @115115+identifier fops0.fops;116116+identifier write_iter_f;117117+@@118118+ struct file_operations fops = {119119+ .write_iter = write_iter_f,120120+ };121121+122122+@ has_llseek @123123+identifier fops0.fops;124124+identifier llseek_f;125125+@@126126+ struct file_operations fops = {127127+ .llseek = llseek_f,128128+ };129129+130130+@ has_no_llseek @131131+identifier fops0.fops;132132+@@133133+ struct file_operations fops = {134134+ .llseek = no_llseek,135135+ };136136+137137+@ has_mmap @138138+identifier fops0.fops;139139+identifier mmap_f;140140+@@141141+ struct file_operations fops = {142142+ .mmap = mmap_f,143143+ };144144+145145+@ has_copy_file_range @146146+identifier fops0.fops;147147+identifier copy_file_range_f;148148+@@149149+ struct file_operations fops = {150150+ .copy_file_range = copy_file_range_f,151151+ };152152+153153+@ has_remap_file_range @154154+identifier fops0.fops;155155+identifier remap_file_range_f;156156+@@157157+ struct file_operations fops = {158158+ .remap_file_range = remap_file_range_f,159159+ };160160+161161+@ has_splice_read @162162+identifier fops0.fops;163163+identifier splice_read_f;164164+@@165165+ struct file_operations fops = {166166+ .splice_read = splice_read_f,167167+ };168168+169169+@ has_splice_write @170170+identifier fops0.fops;171171+identifier splice_write_f;172172+@@173173+ struct file_operations fops = {174174+ .splice_write = splice_write_f,175175+ };176176+177177+178178+// file_operations that is candidate for stream_open conversion - it does not179179+// use mmap and other methods that assume @offset access to file.180180+//181181+// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now.182182+// XXX maybe_steam.fops cannot be used in other rules - it gives "bad rule maybe_stream or bad variable fops".183183+@ maybe_stream depends on (!has_llseek || has_no_llseek) && !has_mmap && !has_copy_file_range && !has_remap_file_range && !has_read_iter && !has_write_iter && !has_splice_read && !has_splice_write @184184+identifier fops0.fops;185185+@@186186+ struct file_operations fops = {187187+ };188188+189189+190190+// ---- conversions ----191191+192192+// XXX .open = nonseekable_open -> .open = stream_open193193+// XXX .open = func -> openfunc -> nonseekable_open194194+195195+// read & write196196+//197197+// if both are used in the same file_operations together with an opener -198198+// under that conditions we can use stream_open instead of nonseekable_open.199199+@ fops_rw depends on maybe_stream @200200+identifier fops0.fops, openfunc;201201+identifier stream_reader.readstream;202202+identifier stream_writer.writestream;203203+@@204204+ struct file_operations fops = {205205+ .open = openfunc,206206+ .read = readstream,207207+ .write = writestream,208208+ };209209+210210+@ report_rw depends on report @211211+identifier fops_rw.openfunc;212212+position p1;213213+@@214214+ openfunc(...) {215215+ <...216216+ nonseekable_open@p1217217+ ...>218218+ }219219+220220+@ script:python depends on report && reader_blocks @221221+fops << fops0.fops;222222+p << report_rw.p1;223223+@@224224+coccilib.report.print_report(p[0],225225+ "ERROR: %s: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix." % (fops,))226226+227227+@ script:python depends on report && !reader_blocks @228228+fops << fops0.fops;229229+p << report_rw.p1;230230+@@231231+coccilib.report.print_report(p[0],232232+ "WARNING: %s: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))233233+234234+235235+@ explain_rw_deadlocked depends on explain && reader_blocks @236236+identifier fops_rw.openfunc;237237+@@238238+ openfunc(...) {239239+ <...240240+- nonseekable_open241241++ nonseekable_open /* read & write (was deadlock) */242242+ ...>243243+ }244244+245245+246246+@ explain_rw_nodeadlock depends on explain && !reader_blocks @247247+identifier fops_rw.openfunc;248248+@@249249+ openfunc(...) {250250+ <...251251+- nonseekable_open252252++ nonseekable_open /* read & write (no direct deadlock) */253253+ ...>254254+ }255255+256256+@ patch_rw depends on patch @257257+identifier fops_rw.openfunc;258258+@@259259+ openfunc(...) {260260+ <...261261+- nonseekable_open262262++ stream_open263263+ ...>264264+ }265265+266266+267267+// read, but not write268268+@ fops_r depends on maybe_stream && !has_write @269269+identifier fops0.fops, openfunc;270270+identifier stream_reader.readstream;271271+@@272272+ struct file_operations fops = {273273+ .open = openfunc,274274+ .read = readstream,275275+ };276276+277277+@ report_r depends on report @278278+identifier fops_r.openfunc;279279+position p1;280280+@@281281+ openfunc(...) {282282+ <...283283+ nonseekable_open@p1284284+ ...>285285+ }286286+287287+@ script:python depends on report @288288+fops << fops0.fops;289289+p << report_r.p1;290290+@@291291+coccilib.report.print_report(p[0],292292+ "WARNING: %s: .read() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))293293+294294+@ explain_r depends on explain @295295+identifier fops_r.openfunc;296296+@@297297+ openfunc(...) {298298+ <...299299+- nonseekable_open300300++ nonseekable_open /* read only */301301+ ...>302302+ }303303+304304+@ patch_r depends on patch @305305+identifier fops_r.openfunc;306306+@@307307+ openfunc(...) {308308+ <...309309+- nonseekable_open310310++ stream_open311311+ ...>312312+ }313313+314314+315315+// write, but not read316316+@ fops_w depends on maybe_stream && !has_read @317317+identifier fops0.fops, openfunc;318318+identifier stream_writer.writestream;319319+@@320320+ struct file_operations fops = {321321+ .open = openfunc,322322+ .write = writestream,323323+ };324324+325325+@ report_w depends on report @326326+identifier fops_w.openfunc;327327+position p1;328328+@@329329+ openfunc(...) {330330+ <...331331+ nonseekable_open@p1332332+ ...>333333+ }334334+335335+@ script:python depends on report @336336+fops << fops0.fops;337337+p << report_w.p1;338338+@@339339+coccilib.report.print_report(p[0],340340+ "WARNING: %s: .write() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))341341+342342+@ explain_w depends on explain @343343+identifier fops_w.openfunc;344344+@@345345+ openfunc(...) {346346+ <...347347+- nonseekable_open348348++ nonseekable_open /* write only */349349+ ...>350350+ }351351+352352+@ patch_w depends on patch @353353+identifier fops_w.openfunc;354354+@@355355+ openfunc(...) {356356+ <...357357+- nonseekable_open358358++ stream_open359359+ ...>360360+ }361361+362362+363363+// no read, no write - don't change anything
+25-7
security/keys/trusted.c
···125125 */126126int TSS_authhmac(unsigned char *digest, const unsigned char *key,127127 unsigned int keylen, unsigned char *h1,128128- unsigned char *h2, unsigned char h3, ...)128128+ unsigned char *h2, unsigned int h3, ...)129129{130130 unsigned char paramdigest[SHA1_DIGEST_SIZE];131131 struct sdesc *sdesc;···135135 int ret;136136 va_list argp;137137138138+ if (!chip)139139+ return -ENODEV;140140+138141 sdesc = init_sdesc(hashalg);139142 if (IS_ERR(sdesc)) {140143 pr_info("trusted_key: can't alloc %s\n", hash_alg);141144 return PTR_ERR(sdesc);142145 }143146144144- c = h3;147147+ c = !!h3;145148 ret = crypto_shash_init(&sdesc->shash);146149 if (ret < 0)147150 goto out;···198195 unsigned int dpos;199196 va_list argp;200197 int ret;198198+199199+ if (!chip)200200+ return -ENODEV;201201202202 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);203203 tag = LOAD16(buffer, 0);···369363{370364 int rc;371365366366+ if (!chip)367367+ return -ENODEV;368368+372369 dump_tpm_buf(cmd);373370 rc = tpm_send(chip, cmd, buflen);374371 dump_tpm_buf(cmd);···437428int oiap(struct tpm_buf *tb, uint32_t *handle, unsigned char *nonce)438429{439430 int ret;431431+432432+ if (!chip)433433+ return -ENODEV;440434441435 INIT_BUF(tb);442436 store16(tb, TPM_TAG_RQU_COMMAND);···12571245{12581246 int ret;1259124712481248+ /* encrypted_keys.ko depends on successful load of this module even if12491249+ * TPM is not used.12501250+ */12601251 chip = tpm_default_chip();12611252 if (!chip)12621262- return -ENOENT;12531253+ return 0;12541254+12631255 ret = init_digests();12641256 if (ret < 0)12651257 goto err_put;···1285126912861270static void __exit cleanup_trusted(void)12871271{12881288- put_device(&chip->dev);12891289- kfree(digests);12901290- trusted_shash_release();12911291- unregister_key_type(&key_type_trusted);12721272+ if (chip) {12731273+ put_device(&chip->dev);12741274+ kfree(digests);12751275+ trusted_shash_release();12761276+ unregister_key_type(&key_type_trusted);12771277+ }12921278}1293127912941280late_initcall(init_trusted);